mgokg commited on
Commit
303a5ba
·
verified ·
1 Parent(s): b09ae24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import requests
 
3
  import os
4
  import json
5
  import google.generativeai as genai
@@ -72,9 +73,8 @@ def duckduckgo(search_term):
72
  #response.raise_for_status() # Raises HTTPError for bad responses
73
  s1 = response.text
74
  # Removing HTML tags using Beautiful Soup
75
- soup = BeautifulSoup(s1, "html.parser")
76
- s2 = soup.get_text()
77
- return s1
78
  #return response.text # Return the content of the response
79
  except requests.exceptions.RequestException as e:
80
  print(f"An error occurred: {e}")
 
1
  import gradio as gr
2
  import requests
3
+ import re
4
  import os
5
  import json
6
  import google.generativeai as genai
 
73
  #response.raise_for_status() # Raises HTTPError for bad responses
74
  s1 = response.text
75
  # Removing HTML tags using Beautiful Soup
76
+ s2 = re.sub(r"<.*?>", "", s1)
77
+ return s2
 
78
  #return response.text # Return the content of the response
79
  except requests.exceptions.RequestException as e:
80
  print(f"An error occurred: {e}")