Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -53,6 +53,19 @@ def initialize_youtube_agent():
|
|
53 |
multimodal_Agent = initialize_multimodal_agent()
|
54 |
youtube_agent = initialize_youtube_agent()
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
# Create tabs for different input methods
|
57 |
video_tab, youtube_tab = st.tabs(["Upload Video", "YouTube URL"])
|
58 |
|
@@ -135,7 +148,7 @@ with youtube_tab:
|
|
135 |
try:
|
136 |
with st.spinner("Fetching video content and analyzing..."):
|
137 |
# Generate prompt based on whether there's a user query
|
138 |
-
youtube_prompt =
|
139 |
|
140 |
# Use the YouTube-specific agent to process the video
|
141 |
response = youtube_agent.run(youtube_prompt, markdown=True)
|
@@ -150,22 +163,7 @@ with youtube_tab:
|
|
150 |
else:
|
151 |
st.info("Please enter a YouTube URL to begin analysis.")
|
152 |
|
153 |
-
def generate_youtube_prompt(youtube_query, youtube_url):
|
154 |
-
if youtube_query:
|
155 |
-
return f"Watch this video {youtube_url} and answer the following question: {youtube_query}"
|
156 |
-
return f"Summarize this video {youtube_url}"
|
157 |
|
158 |
-
def generate_analysis_prompt(query, video_source):
|
159 |
-
return f"""
|
160 |
-
Analyze the {video_source} for content and context.
|
161 |
-
Key areas to address:
|
162 |
-
1. Main topics and themes
|
163 |
-
2. Key points and insights
|
164 |
-
3. Specific answer to user query: {query}
|
165 |
-
4. Supporting context from web research
|
166 |
-
|
167 |
-
Provide a structured, detailed response with clear sections and actionable insights.
|
168 |
-
"""
|
169 |
|
170 |
# Custom styling
|
171 |
st.markdown(
|
|
|
53 |
multimodal_Agent = initialize_multimodal_agent()
|
54 |
youtube_agent = initialize_youtube_agent()
|
55 |
|
56 |
+
|
57 |
+
def generate_analysis_prompt(query, video_source):
|
58 |
+
return f"""
|
59 |
+
Analyze the {video_source} for content and context.
|
60 |
+
Key areas to address:
|
61 |
+
1. Main topics and themes
|
62 |
+
2. Key points and insights
|
63 |
+
3. Specific answer to user query: {query}
|
64 |
+
4. Supporting context from web research
|
65 |
+
|
66 |
+
Provide a structured, detailed response with clear sections and actionable insights.
|
67 |
+
"""
|
68 |
+
|
69 |
# Create tabs for different input methods
|
70 |
video_tab, youtube_tab = st.tabs(["Upload Video", "YouTube URL"])
|
71 |
|
|
|
148 |
try:
|
149 |
with st.spinner("Fetching video content and analyzing..."):
|
150 |
# Generate prompt based on whether there's a user query
|
151 |
+
youtube_prompt = generate_analysis_prompt(youtube_query, youtube_url)
|
152 |
|
153 |
# Use the YouTube-specific agent to process the video
|
154 |
response = youtube_agent.run(youtube_prompt, markdown=True)
|
|
|
163 |
else:
|
164 |
st.info("Please enter a YouTube URL to begin analysis.")
|
165 |
|
|
|
|
|
|
|
|
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
# Custom styling
|
169 |
st.markdown(
|