mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-08-28 11:07:19 +08:00
feat: Enhance multimodal AI agent with improved API key handling and model updates
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
## 🧬 Multimodal AI Agent
|
||||
|
||||
A Streamlit application that combines video analysis and web search capabilities using Google's Gemini 2.0 model. This agent can analyze uploaded videos and answer questions by combining visual understanding with web-search.
|
||||
A Streamlit application that combines video analysis and web search capabilities using Google's Gemini 2.5 model. This agent can analyze uploaded videos and answer questions by combining visual understanding with web-search.
|
||||
|
||||
### Features
|
||||
|
||||
- Video analysis using Gemini 2.0 Flash
|
||||
- Video analysis using Gemini 2.5 Flash/Pro
|
||||
- Web research integration via DuckDuckGo
|
||||
- Support for multiple video formats (MP4, MOV, AVI)
|
||||
- Real-time video processing
|
||||
|
||||
@@ -1,25 +1,40 @@
|
||||
import streamlit as st
|
||||
from agno.agent import Agent
|
||||
from agno.run.agent import RunOutput
|
||||
from agno.media import Image
|
||||
from agno.models.google import Gemini
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
def main():
|
||||
# Set up the reasoning agent
|
||||
agent = Agent(
|
||||
model=Gemini(id="gemini-2.0-flash-thinking-exp-1219"),
|
||||
markdown=True
|
||||
)
|
||||
|
||||
# Streamlit app title
|
||||
st.title("Multimodal Reasoning AI Agent 🧠")
|
||||
|
||||
# Get Gemini API key from user in sidebar
|
||||
with st.sidebar:
|
||||
st.header("🔑 Configuration")
|
||||
gemini_api_key = st.text_input("Enter your Gemini API Key", type="password")
|
||||
st.caption(
|
||||
"Get your API key from [Google AI Studio]"
|
||||
"(https://aistudio.google.com/apikey) 🔑"
|
||||
)
|
||||
|
||||
# Instruction
|
||||
st.write(
|
||||
"Upload an image and provide a reasoning-based task for the AI Agent. "
|
||||
"The AI Agent will analyze the image and respond based on your input."
|
||||
)
|
||||
|
||||
if not gemini_api_key:
|
||||
st.warning("Please enter your Gemini API key in the sidebar to continue.")
|
||||
return
|
||||
|
||||
# Set up the reasoning agent
|
||||
agent = Agent(
|
||||
model=Gemini(id="gemini-2.5-pro", api_key=gemini_api_key),
|
||||
markdown=True
|
||||
)
|
||||
|
||||
# File uploader for image
|
||||
uploaded_file = st.file_uploader("Upload Image", type=["jpg", "jpeg", "png"])
|
||||
|
||||
@@ -43,7 +58,7 @@ def main():
|
||||
with st.spinner("AI is thinking... 🤖"):
|
||||
try:
|
||||
# Call the agent with the dynamic task and image path
|
||||
response = agent.run(task_input, images=[temp_path])
|
||||
response: RunOutput = agent.run(task_input, images=[Image(filepath=temp_path)])
|
||||
|
||||
# Display the response from the model
|
||||
st.markdown("### AI Response:")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import streamlit as st
|
||||
from agno.agent import Agent
|
||||
from agno.run.agent import RunOutput
|
||||
from agno.models.google import Gemini
|
||||
from agno.media import Video
|
||||
import time
|
||||
@@ -14,15 +15,21 @@ st.set_page_config(
|
||||
|
||||
st.title("Multimodal AI Agent 🧬")
|
||||
|
||||
# Get Gemini API key from user
|
||||
gemini_api_key = st.text_input("Enter your Gemini API Key", type="password")
|
||||
# Get Gemini API key from user in sidebar
|
||||
with st.sidebar:
|
||||
st.header("🔑 Configuration")
|
||||
gemini_api_key = st.text_input("Enter your Gemini API Key", type="password")
|
||||
st.caption(
|
||||
"Get your API key from [Google AI Studio]"
|
||||
"(https://aistudio.google.com/apikey) 🔑"
|
||||
)
|
||||
|
||||
# Initialize single agent with both capabilities
|
||||
@st.cache_resource
|
||||
def initialize_agent(api_key):
|
||||
return Agent(
|
||||
name="Multimodal Analyst",
|
||||
model=Gemini(id="gemini-2.0-flash", api_key=api_key),
|
||||
model=Gemini(id="gemini-2.5-flash", api_key=api_key),
|
||||
markdown=True,
|
||||
)
|
||||
|
||||
@@ -60,7 +67,7 @@ if gemini_api_key:
|
||||
Provide a comprehensive response focusing on practical, actionable information.
|
||||
"""
|
||||
|
||||
result = agent.run(prompt, videos=[video])
|
||||
result: RunOutput = agent.run(prompt, videos=[video])
|
||||
|
||||
st.subheader("Result")
|
||||
st.markdown(result.content)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
agno
|
||||
agno>=2.2.10
|
||||
google-generativeai==0.8.3
|
||||
streamlit==1.40.2
|
||||
Reference in New Issue
Block a user