awacke1 commited on
Commit
3e053da
1 Parent(s): 4a97bf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -159,6 +159,14 @@ def fetch_wikipedia_summary(keyword):
159
  # In a real app, you might use requests to fetch from the Wikipedia API
160
  return f"Summary for {keyword}. For more information, visit Wikipedia."
161
 
 
 
 
 
 
 
 
 
162
  def create_search_url_wikipedia(keyword):
163
  base_url = "https://www.wikipedia.org/search-redirect.php?family=wikipedia&language=en&search="
164
  return base_url + keyword.replace(' ', '+')
@@ -179,13 +187,20 @@ def display_images_and_wikipedia_summaries():
179
  st.image(image, caption=image_file, use_column_width=True)
180
 
181
  keyword = image_file.split('.')[0] # Assumes keyword is the file name without extension
182
- wikipedia_summary = fetch_wikipedia_summary(keyword)
183
- st.write(wikipedia_summary)
184
 
185
  # Display Wikipedia and Google search links
186
  wikipedia_url = create_search_url_wikipedia(keyword)
187
  google_url = create_search_url_google(keyword)
188
- st.markdown(f"[Wikipedia]({wikipedia_url}) | [Google]({google_url})")
 
 
 
 
 
 
 
 
 
189
 
190
  display_images_and_wikipedia_summaries()
191
 
 
159
  # In a real app, you might use requests to fetch from the Wikipedia API
160
  return f"Summary for {keyword}. For more information, visit Wikipedia."
161
 
162
+ def create_search_url_youtube(keyword):
163
+ base_url = "https://www.youtube.com/results?search_query="
164
+ return base_url + keyword.replace(' ', '+')
165
+
166
+ def create_search_url_bing(keyword):
167
+ base_url = "https://www.bing.com/search?q="
168
+ return base_url + keyword.replace(' ', '+')
169
+
170
  def create_search_url_wikipedia(keyword):
171
  base_url = "https://www.wikipedia.org/search-redirect.php?family=wikipedia&language=en&search="
172
  return base_url + keyword.replace(' ', '+')
 
187
  st.image(image, caption=image_file, use_column_width=True)
188
 
189
  keyword = image_file.split('.')[0] # Assumes keyword is the file name without extension
 
 
190
 
191
  # Display Wikipedia and Google search links
192
  wikipedia_url = create_search_url_wikipedia(keyword)
193
  google_url = create_search_url_google(keyword)
194
+ youtube_url = create_search_url_youtube(keyword)
195
+ bing_url = create_search_url_bing(keyword)
196
+
197
+ links_md = f"""
198
+ [Wikipedia]({wikipedia_url}) |
199
+ [Google]({google_url}) |
200
+ [YouTube]({youtube_url}) |
201
+ [Bing]({bing_url})
202
+ """
203
+ st.markdown(links_md)
204
 
205
  display_images_and_wikipedia_summaries()
206