0

reading this : https://benheubl.github.io/data%20analysis/fr/ and try to follow.

I separate the two python code and after running one I copied the video location. But so far cannot proceed to stage 2 i.e. get the result and then save it for the R to analysis. My response file is

getResponse.text is : 
{"status":"Failed","progress":null,"createdDateTime":"2016-10-
23T12:03:50.525844Z","lastActionDateTime":"2016-10-
23T12:03:50.5414685Z","message":"Failed to start job."}



Traceback (most recent call last):

File "...face-recognition1-after-waiting.py", line 63, in <module>
rawData = json.loads(json.loads(getResponse.text)
['processingResult'])

KeyError: 'processingResult'

The key is right and the previous response is ok:

202

{'Content-Length': '0', 'Expires': '-1', 'X-AspNet-Version': '4.0.30319', 'Operation-Location': 'https://api.projectoxford.ai/emotion/v1.0/operations/aad68da1-38e4-4722-8c64-cfbf19d1de97', 'X-Powered-By': 'ASP.NET', 'apim-request-id': '7cdb9bf5-234e-4566-afeb-b68a0dfd25df', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', 'Date': 'Sun, 23 Oct 2016 12:03:52 GMT'}

seems cannot proceed further ... any help?

Dennis Ng
  • 331
  • 3
  • 9
  • Not sure why downgrade for a very innocent question of not moving anywhere after working on it for hours. Really need some help as no cure how to proceed further. Anyway I did and I pose my answer below to save my reputation :-) – Dennis Ng Oct 25 '16 at 04:18

1 Answers1

1

After working more on this question, I find the issue is that whilst there is a 202 answer the details is that the upload is not working. Hence, there is no files for me to download. With that in mind, the procedure would be

  1. Read and copy those codes from benheubl.github.io/data%20analysis/fr/ (which is the basic materials for http://www.economist.com/blogs/graphicdetail/2016/10/daily-chart-12)

  2. Sign in and get the keys from www.microsoft.com/cognitive-services/en-us/subscriptions

  3. run the first part of the script up to " print videoIDLocation"

  4. Note down the videoIDLocation something like api.projectoxford.ai/emotion/v1.0/operations/a2fcb40e-d7d0-4483-89e7-250201ac01d5 # a2fc...c01d5 is expired after 24 hours

  5. Check the status by going to the "Cognitive Services" and under the "Get recognition in Video operation result" run the "Open API Testing Console" You need the subscription key and also the oid which is a2fcb40e-d7d0-4483-89e7-250201ac01d5 above

  6. That is the waiting for coffee part (and also that you are not waiting for Godet due to error as the 202 is not really a confirmation everywhere is ok. It is not ok somethings.)

  7. When you see a lot of codes in the testing script above, run the second part of the python script after copied the location.

  8. Run the R code but beware (# not working here I use - as comments)

    • use getcwd, setcwd('~/...'), getcwd, list.files etc to ensure dir is right
    • you need to install.packages including
    • install.packages('magrittr')
    • install.packages('dplR') # <-- not sure about this
    • install.packages('dplyr')
    • install.packages('tidyr') # need for the %>%
    • install.packages('ggplot2')

    • and amend one of the mistakes of the code i.e.

    • View(trump_g) should be View(blog_trump)
    • comment this line out in the ggplot
    • would display all the non-smoothed lines
Dennis Ng
  • 331
  • 3
  • 9