Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -85,10 +85,6 @@ with youtube_tab:
|
|
85 |
placeholder="https://www.youtube.com/watch?v=..."
|
86 |
)
|
87 |
|
88 |
-
def generate_youtube_prompt(youtube_query, youtube_url):
|
89 |
-
if youtube_query:
|
90 |
-
return f"Watch this video {youtube_url} and answer the following question: {youtube_query}"
|
91 |
-
return f"Summarize this video {youtube_url}"
|
92 |
|
93 |
def generate_analysis_prompt(query, video_source):
|
94 |
return f"""
|
@@ -148,8 +144,22 @@ if video_file:
|
|
148 |
Path(video_path).unlink(missing_ok=True)
|
149 |
|
150 |
# Process YouTube URL
|
151 |
-
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
if st.button("π Analyze YouTube Video", use_container_width=True):
|
154 |
try:
|
155 |
with st.spinner("Fetching video content and analyzing..."):
|
@@ -166,7 +176,9 @@ if youtube_url:
|
|
166 |
|
167 |
except Exception as error:
|
168 |
st.error(f"An error occurred: {str(error)}")
|
169 |
-
|
|
|
|
|
170 |
# Custom styling
|
171 |
st.markdown(
|
172 |
"""
|
|
|
85 |
placeholder="https://www.youtube.com/watch?v=..."
|
86 |
)
|
87 |
|
|
|
|
|
|
|
|
|
88 |
|
89 |
def generate_analysis_prompt(query, video_source):
|
90 |
return f"""
|
|
|
144 |
Path(video_path).unlink(missing_ok=True)
|
145 |
|
146 |
# Process YouTube URL
|
147 |
+
# YouTube URL Tab
|
148 |
+
with youtube_tab:
|
149 |
+
youtube_query = st.text_area(
|
150 |
+
"What would you like to know about the YouTube video?",
|
151 |
+
placeholder="Ask specific questions about the video or leave empty for a general summary.",
|
152 |
+
help="Enter your question about the YouTube video or leave blank for a general summary.",
|
153 |
+
key="youtube_query"
|
154 |
+
)
|
155 |
+
|
156 |
+
youtube_url = st.text_input(
|
157 |
+
"Paste a YouTube URL:",
|
158 |
+
placeholder="https://www.youtube.com/watch?v=..."
|
159 |
+
)
|
160 |
+
|
161 |
+
# Process YouTube URL within the tab
|
162 |
+
if youtube_url:
|
163 |
if st.button("π Analyze YouTube Video", use_container_width=True):
|
164 |
try:
|
165 |
with st.spinner("Fetching video content and analyzing..."):
|
|
|
176 |
|
177 |
except Exception as error:
|
178 |
st.error(f"An error occurred: {str(error)}")
|
179 |
+
else:
|
180 |
+
st.info("Please enter a YouTube URL to begin analysis.")
|
181 |
+
|
182 |
# Custom styling
|
183 |
st.markdown(
|
184 |
"""
|