supertakerin2 commited on
Commit
cd39ed9
ยท
verified ยท
1 Parent(s): 55e029b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -28
app.py CHANGED
@@ -163,34 +163,7 @@ if prompt := st.chat_input("ใƒกใƒƒใ‚ปใƒผใ‚ธใ‚’ๅ…ฅๅŠ›ใ—ใฆใใ ใ•ใ„"):
163
  full_response = chain.invoke({"text": text_to_summarize})["text"]
164
  message_placeholder.markdown(full_response)
165
 
166
-
167
- elif mode == "video":
168
- search_results = tavily_client.search(f"{prompt} site:youtube.com", search_depth="basic", include_images=True)
169
- videos = [result for result in search_results["results"]
170
- if "youtube.com" in result["url"]]
171
- if videos:
172
- for video in videos[:4]:
173
- video_url = video['url']
174
- video_id = None
175
- youtube_patterns = [
176
- r"(?<=v=)[^]+",
177
- r"(?<=be/)[^]+",
178
- r"(?<=embed/)[^]+"
179
- ]
180
- for pattern in youtube_patterns:
181
- match = re.search(pattern, video_url)
182
- if match:
183
- video_id = match.group()
184
- break
185
- if video_id:
186
- st.markdown(f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>', unsafe_allow_html=True)
187
- st.markdown(f"้–ข้€ฃๅ‹•็”ป: {video['title']}")
188
- else:
189
- st.warning(f"ๅ‹•็”ปIDใ‚’ๆŠฝๅ‡บใงใใพใ›ใ‚“ใงใ—ใŸ: {video_url}")
190
- else:
191
- full_response = "้–ข้€ฃๅ‹•็”ปใŒ่ฆ‹ใคใ‹ใ‚Šใพใ›ใ‚“ใงใ—ใŸใ€‚"
192
- message_placeholder.markdown(full_response)
193
-
194
 
195
  # ใ‚ณใƒ”ใƒผๆฉŸ่ƒฝใฎ่ฟฝๅŠ 
196
  if st.button("๐Ÿ“‹ ็”Ÿๆˆใ•ใ‚ŒใŸใƒ†ใ‚ญใ‚นใƒˆใ‚’ใ‚ณใƒ”ใƒผ"):
 
163
  full_response = chain.invoke({"text": text_to_summarize})["text"]
164
  message_placeholder.markdown(full_response)
165
 
166
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
 
168
  # ใ‚ณใƒ”ใƒผๆฉŸ่ƒฝใฎ่ฟฝๅŠ 
169
  if st.button("๐Ÿ“‹ ็”Ÿๆˆใ•ใ‚ŒใŸใƒ†ใ‚ญใ‚นใƒˆใ‚’ใ‚ณใƒ”ใƒผ"):