Bey007 commited on
Commit
6f16ee7
·
verified ·
1 Parent(s): 306cf81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
  from gtts import gTTS
4
- from yt_search import yt_search # Updated YouTube search import
5
  import os
6
 
7
  # Initialize conversational models
@@ -56,9 +56,10 @@ if user_input:
56
  activity = st.selectbox("Choose an activity you'd like to try:", hobbies)
57
 
58
  # Search YouTube for videos related to the selected activity
59
- search_results = yt_search(activity, limit=2)
 
60
  for video in search_results:
61
- st.write(f"[{video['title']}]({video['url']})")
62
 
63
  # Crisis resources
64
  crisis_keywords = ["help", "suicide", "depressed", "emergency", "hurt", "lost"]
 
1
  import streamlit as st
2
  from transformers import pipeline
3
  from gtts import gTTS
4
+ from youtubesearchpython import VideosSearch
5
  import os
6
 
7
  # Initialize conversational models
 
56
  activity = st.selectbox("Choose an activity you'd like to try:", hobbies)
57
 
58
  # Search YouTube for videos related to the selected activity
59
+ search = VideosSearch(activity, limit=2)
60
+ search_results = search.result()['result']
61
  for video in search_results:
62
+ st.write(f"[{video['title']}]({video['link']})")
63
 
64
  # Crisis resources
65
  crisis_keywords = ["help", "suicide", "depressed", "emergency", "hurt", "lost"]