Test_tag_suggestion clarifyapi assertion error

print(actual_tag_suggesstion_received)
assert type(actual_tag_suggesstion_received) == type([])

  assert expected_tag_suggestion[0:3] == actual_tag_suggesstion_received[0:3]

E AssertionError: assert [‘rice’, ‘meat’, ‘vegetable’] == []
E Left contains 3 more items, first extra item: ‘rice’
E Use -v to get the full diff

tests/test_views.py:157: AssertionError
----------------------------- Captured stdout call -----------------------------
[]

Hi @vishnu
Looks like you are facing challenges in the current module.

Below are a few similar topics raised by other users which you might find usefull

Note - This is a BETA Feature,if you find this helpful, kindly let us know.
Feedback link - https://forms.gle/cmxN5pdTXgnwgC986

Kindly mark this as a solution if this has helped you solve your query

Your list of tags are empty. Make sure that your list contains those tags. print the list and check the tags. 1. Please make sure your API call is correct. Use correct format.
There are 2 parameters header and data.
Header contains ‘Authorization’, ‘Content-Type’.
Data contains the body.

Please visit this page and observe the curl command carefully.
https://docs.clarifai.com/api-guide/predict/images
The below website would also be helpful.
https://curl.trillworks.com/

I guess I have did the get_tags_suggestion() correctly but i am not sure where to place the list of tags

I am not able to solve this I think i am missing something can anyone guide me?

Please don’t remove any contents from views.py, this file seems to be empty in your repository, you have to call the get_tags_suggestion() function in the views.py file and extract the tags out.

I haven’t changed anything in views.py file

Refer the TODO’s in views.py

    # TODO: CRIO_TASK_MODULE_TAG_SUGGESTION
    # Add call to clarifai api here.
    # Refer todo in qeats/restaurants/clarifai_tag_suggestions.py for instructions

Think you will get an idea about what has to be done here

I am not able to call the api. I think that is the only thing left out

Refer to the TODO’s in views.py,
you have to call the api in clarifai_tag_suggestions.py,
but call the function in views.py,
to retrieve a list of tags

@vishnu from the dms you sent on slack, I realise that you have been able to successfully get a response. All you need to do to complete the claraifai tags function is to parse the json structure to extract the tags, and finally return it as a list (of received tags). Then as Rahul mentioned, you need to call this function in the views.py file.

I got the tags and I m facing issues in parsing and calling the function in views.py file

Try printing out the response you got. Feel free to send a picture of it here so we can be sure that you got the correct response.

I think by looking at the response, you’ll get an idea of how to extract the tags.

Put all the extracted tags in a list and return that.
(This is all in the claraifai function)


status code is 200
Have a look at the response

So I meant the actual json response you got from the claraifai api.

I am getting the response 400

Closing this topic as your issue has been resolved by the community. If not Kindly un-mark the accepted solution to re-open the topic or feel free to create a new topic and post a link to this topic as a reference.