Manasa1 commited on
Commit
05f5c6f
·
verified ·
1 Parent(s): 16ebd6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -9
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 Youtube video using video link 🎬 🧷")
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. Obtain the captions of a YouTube video, analyze its content and context, provide summaries, conduct web research on similar topics, and answer user questions.",
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"""Respond to the following query using video insights and supplementary web research:
129
- {user_query}
130
- Provide a detailed, user-friendly, and actionable response.
131
- Video URL: {video_url}""" # Added Video URL for context
 
132
  else:
133
- prompt = f"""Provide a detailed, user-friendly, and actionable response.
134
- Video URL: {video_url}"""
 
 
 
 
135
  output = youtube_agent.run(prompt)
136
 
137
- st.markdown(output.content)
 
 
 
 
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}")