Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,10 @@ import os
|
|
4 |
import json
|
5 |
import google.generativeai as genai
|
6 |
from bs4 import BeautifulSoup
|
7 |
-
from googleapiclient.discovery import build
|
8 |
|
9 |
# Load environment variables
|
10 |
genai.configure(api_key=os.environ["geminiapikey"])
|
11 |
read_key = os.environ.get('HF_TOKEN', None)
|
12 |
-
apikey = os.environ["geminiapikey"]
|
13 |
|
14 |
custom_css = """
|
15 |
#md {
|
@@ -21,7 +19,6 @@ custom_css = """
|
|
21 |
border: 1 px solid white;
|
22 |
}
|
23 |
"""
|
24 |
-
|
25 |
def get_impressum_text(search_term):
|
26 |
|
27 |
headers = {
|
@@ -29,7 +26,7 @@ def get_impressum_text(search_term):
|
|
29 |
}
|
30 |
|
31 |
#search_results = google_search(search_term)
|
32 |
-
url = f"https://
|
33 |
response = requests.get(url, headers=headers)
|
34 |
soup = BeautifulSoup(response.content, 'html.parser')
|
35 |
impressum_div = soup.find('body')
|
@@ -43,7 +40,6 @@ def get_impressum_text(search_term):
|
|
43 |
soup = BeautifulSoup(response.content, 'html.parser')
|
44 |
|
45 |
impressum_div = soup.find('div', class_='MjjYud')
|
46 |
-
|
47 |
return impressum_div.text.strip()
|
48 |
|
49 |
def websearch(prompt):
|
|
|
4 |
import json
|
5 |
import google.generativeai as genai
|
6 |
from bs4 import BeautifulSoup
|
|
|
7 |
|
8 |
# Load environment variables
|
9 |
genai.configure(api_key=os.environ["geminiapikey"])
|
10 |
read_key = os.environ.get('HF_TOKEN', None)
|
|
|
11 |
|
12 |
custom_css = """
|
13 |
#md {
|
|
|
19 |
border: 1 px solid white;
|
20 |
}
|
21 |
"""
|
|
|
22 |
def get_impressum_text(search_term):
|
23 |
|
24 |
headers = {
|
|
|
26 |
}
|
27 |
|
28 |
#search_results = google_search(search_term)
|
29 |
+
url = f"https://www.google.com/search?q=mpressum {search_term}"
|
30 |
response = requests.get(url, headers=headers)
|
31 |
soup = BeautifulSoup(response.content, 'html.parser')
|
32 |
impressum_div = soup.find('body')
|
|
|
40 |
soup = BeautifulSoup(response.content, 'html.parser')
|
41 |
|
42 |
impressum_div = soup.find('div', class_='MjjYud')
|
|
|
43 |
return impressum_div.text.strip()
|
44 |
|
45 |
def websearch(prompt):
|