Update app.py
Browse files
app.py
CHANGED
@@ -102,7 +102,7 @@ with tab1:
|
|
102 |
# Tab 2: YouTube Video Analyzer with Groq
|
103 |
with tab2:
|
104 |
st.title("YouTube Video Analyzer")
|
105 |
-
st.header("Analyze
|
106 |
|
107 |
# Initialize the agent for YouTube analysis
|
108 |
try:
|
@@ -111,7 +111,7 @@ with tab2:
|
|
111 |
tools=[YouTubeTools(), DuckDuckGo()],
|
112 |
show_tool_calls=True,
|
113 |
get_video_captions=True,
|
114 |
-
description="You are a YouTube agent.
|
115 |
)
|
116 |
except Exception as e:
|
117 |
st.error(f"Error initializing the agent: {e}")
|
@@ -124,17 +124,27 @@ with tab2:
|
|
124 |
if video_url:
|
125 |
with st.spinner("Analyzing..."):
|
126 |
try:
|
|
|
127 |
if user_query:
|
128 |
-
prompt = f"""
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
132 |
else:
|
133 |
-
prompt = f"""
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
output = youtube_agent.run(prompt)
|
136 |
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
|
139 |
except Exception as e:
|
140 |
st.error(f"Error analyzing the video: {e}")
|
|
|
102 |
# Tab 2: YouTube Video Analyzer with Groq
|
103 |
with tab2:
|
104 |
st.title("YouTube Video Analyzer")
|
105 |
+
st.header("Analyze YouTube Video Using Video Link 🎬 🧷")
|
106 |
|
107 |
# Initialize the agent for YouTube analysis
|
108 |
try:
|
|
|
111 |
tools=[YouTubeTools(), DuckDuckGo()],
|
112 |
show_tool_calls=True,
|
113 |
get_video_captions=True,
|
114 |
+
description="You are a YouTube analysis agent. Extract captions, analyze the video for key points and summaries, and conduct web research on related topics.",
|
115 |
)
|
116 |
except Exception as e:
|
117 |
st.error(f"Error initializing the agent: {e}")
|
|
|
124 |
if video_url:
|
125 |
with st.spinner("Analyzing..."):
|
126 |
try:
|
127 |
+
# Prepare the prompt
|
128 |
if user_query:
|
129 |
+
prompt = f"""
|
130 |
+
Analyze the YouTube video at the following URL: {video_url}.
|
131 |
+
Extract the captions, summarize the video, and provide detailed key points.
|
132 |
+
Additionally, respond to the user's query: {user_query}.
|
133 |
+
"""
|
134 |
else:
|
135 |
+
prompt = f"""
|
136 |
+
Analyze the YouTube video at the following URL: {video_url}.
|
137 |
+
Extract the captions, summarize the video, and provide detailed key points.
|
138 |
+
"""
|
139 |
+
|
140 |
+
# Run the agent
|
141 |
output = youtube_agent.run(prompt)
|
142 |
|
143 |
+
# Display the results
|
144 |
+
st.subheader("Analysis Result")
|
145 |
+
st.markdown("### Detailed Summary")
|
146 |
+
st.write(output.content) # The complete analysis
|
147 |
+
|
148 |
|
149 |
except Exception as e:
|
150 |
st.error(f"Error analyzing the video: {e}")
|