I have performed the challenge lab ( Explore Generative AI with the Gemini API in Vertex AI: Challenge Lab ) but the last task is not accepting progress after completing it properly
Anyone has any idea about this, please let me know
Solved! Go to Solution.
Do not change code of gemini-explorer-challenge-v2.0.0.ipynb .
Code is different from earlier version, There is new version from 29th April 25.
Please replace carefully below information. and run code. After running code save notebook. last task will take little time complete. Use check tasks against Tasks, not yellow one on right. it takes more time. Keep learning. All the best. It worked for me after different combinations. If it works for you mark this Post as solution.
----------------------------------------------------------------------
# Task 3.1
replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
------------------
# Task 3.2
replace INSERT CORRECT CLASSNAME with
FunctionDeclaration
---------------------
# Task 3.3
replace INSERT CORRECT CLASSNAME with
Tool
------------------------------
# Task 3.4
replace INSERT TOOL TO USE with
weather_tool
----------------------------
# Task 4.1
replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
-------------------------------
# Task 4.2 Generate a video description
replace INPUT CORRECT CLASSNAME with
Part
+++++++++++++++++++++
replace INSERT VIDEO URI with
gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4
+++++++++++++++++++++++
replace INSERT CORRECT METHOD NAME with
generate_content_stream
-----------------------------
There is no problem with lab or config. Lab is recently updated . old YouTube scripts won't work. you need to use knowledge from other labs in this course to complete challenge lab.
All the best
Everything I have done with my knowledge a got solution on 3rd attempt but it's not taking as complete in progress in the last task, and showing 60% completed
If It can helps, you have to look carefully at the documentation provided in 4th task in Jupyter Lab (4.3 cell, above the Video URI reference), you have to pay attention at each class name needed there.
Do not change code of gemini-explorer-challenge-v2.0.0.ipynb .
Code is different from earlier version, There is new version from 29th April 25.
Please replace carefully below information. and run code. After running code save notebook. last task will take little time complete. Use check tasks against Tasks, not yellow one on right. it takes more time. Keep learning. All the best. It worked for me after different combinations. If it works for you mark this Post as solution.
----------------------------------------------------------------------
# Task 3.1
replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
------------------
# Task 3.2
replace INSERT CORRECT CLASSNAME with
FunctionDeclaration
---------------------
# Task 3.3
replace INSERT CORRECT CLASSNAME with
Tool
------------------------------
# Task 3.4
replace INSERT TOOL TO USE with
weather_tool
----------------------------
# Task 4.1
replace <<INSERT CORRECT MODEL NAME HERE>> with
gemini-2.0-flash-001
-------------------------------
# Task 4.2 Generate a video description
replace INPUT CORRECT CLASSNAME with
Part
+++++++++++++++++++++
replace INSERT VIDEO URI with
gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4
+++++++++++++++++++++++
replace INSERT CORRECT METHOD NAME with
generate_content_stream
-----------------------------
Thanks @RAOKS. Finally, it's done in 5th attempt
generate_content_stream this was my mistake, one word
I was happy I could help you to solve your problem. I want you to explore different options so that you learn. well tried. we all learn when we face errors.
From above solution posted by me , I am happy as you have identified why Task #4 check task is not completing earlier and now its given Green tick . I really appreciate your effort. You are right generate_content_stream . With generarate_content , it's throwing print related errors, So for a day I have tried different print options which has given same output as generate_content_stream .
As check task is more concentrating on this particular command execution than output. Task #4 was giving error.
Then I have diagnosed and found generate_content_stream execution is expected by lab for #Task #4
Keep learning. All the best.
I learned a lot from this thing and thanks to you @RAOKS for saving my next 10 or 15 credits 😅 . And all the best to you to
@AshishSBhavsar Bro Can you please share the code. i have tried this lab 5 times but didn't get the score.
@vinayakgupta thanks for reaching me
@RAOKS already shared the solution and I accepted it as the solution so just scroll a bit up and you will find that up
It is not working
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[37], line 13 1 # Task 4.2 Generate a video description 2 # In this cell, update the prompt to ask Gemini to describe the video URL referenced. 3 # You can use the documentation at the following link to assist. 4 # https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/sdk-for-gemini/gemini-sdk-overview-... 5 # https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#sample-requests-text... 6 # Video URI: gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4 8 prompt = """ 9 What is shown in this video? 10 Where should I go to see it? 11 What are the top 5 places in the world that look like this? 12 """ ---> 13 video = Part.from_uri( 14 file_uri="gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4", 15 mime_type="video/mp4", 16 ) 17 contents = [prompt, video] 19 responses = client.models.generate_content_stream( 20 model=multimodal_model, 21 contents=contents 22 ) TypeError: Part.from_uri() got an unexpected keyword argument 'file_uri'
# Task 4.2 Generate a video description
# In this cell, update the prompt to ask Gemini to describe the video URL referenced.
# You can use the documentation at the following link to assist.
# https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/sdk-for-gemini/gemini-sdk-overview-...
# https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#sample-requests-text...
# Video URI: gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4
prompt = """
What is shown in this video?
Where should I go to see it?
What are the top 5 places in the world that look like this?
"""
video = Part.from_uri(
file_uri="gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4",
mime_type="video/mp4",
)
contents = [prompt, video]
responses = client.models.generate_content_stream(
model=multimodal_model,
contents=contents
)
print("-------Prompt--------")
print_multimodal_prompt(contents)
print("\n-------Response--------")
for response in responses:
print(response.text, end="")
It's giving type error
Carefully replace information as mentioned in solution post (solution posted on Saturday). for each task. It is working and I have tested today also.
Just replace capital letters information with info I want I have mentioned. Some are case sensitive. (for 3.1 and 4.1 replace including << >>)
After running code. save notebook. Wait for sometime for Task #4 as it takes time for Green tick.
-------------------
Output for Task # 4, you will see text , one video and text below the video
----------------
###Output of Task #4
-------Prompt--------
What is shown in this video?
Where should I go to see it?
What are the top 5 places in the world that look like this?
It will display video here (gs://github-repo/img/gemini/multimodality_usecases_overview/mediterraneansea.mp4)
-------Response--------
Here's the information about the video and similar locations:
* **What is shown in this video?**
* The video shows an aerial view of a harbor or marina with a lighthouse in Antalya, Turkey. There are cliffs, buildings, and various boats in the harbor.
* **Where should I go to see it?**
* To see this particular view, you should travel to Antalya, Turkey. The video captures a part of the Old Town harbor (Kaleici).
* **What are the top 5 places in the world that look like this?**
It's difficult to say definitively what the "top 5" are since beauty is subjective, but here are 5 locations that share similar characteristics (coastal cliffs, harbors, and Mediterranean-style architecture):
1. **Cinque Terre, Italy:** Colorful villages nestled into steep cliffs along the Italian Riviera.
2. **Dubrovnik, Croatia:** A historic walled city on the Adriatic coast with dramatic cliffs and beautiful waters.
3. **Santorini, Greece:** Whitewashed buildings on volcanic cliffs overlooking the Aegean Sea.
4. **Valparaiso, Chile:** A vibrant port city with colorful houses climbing steep hills.
5. **Menton, France:** A charming coastal town with a picturesque harbor and colorful buildings on the French Riviera.
As @RAOKS Mentioned above. the lab got updated recently. You need to complete the lab by applying your skills or Read the instructions carefully and execute the solutions.
User | Count |
---|---|
24 | |
15 | |
4 | |
2 | |
1 |