Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,22 +13,21 @@ def google_search(query):
|
|
13 |
# Holt den Inhalt der Webseite
|
14 |
response = requests.get(url)
|
15 |
soup = BeautifulSoup(response.text, 'html.parser')
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
return f"Ein Fehler ist aufgetreten: {str(e)}"
|
25 |
|
26 |
demo = gr.Interface(
|
27 |
fn=google_search,
|
28 |
inputs=gr.Textbox(lines=2, placeholder="Geben Sie Ihre Suchanfrage ein..."),
|
29 |
outputs="text",
|
30 |
-
title="
|
31 |
-
description="Geben Sie eine Suchanfrage ein
|
32 |
)
|
33 |
|
34 |
-
demo.launch()
|
|
|
13 |
# Holt den Inhalt der Webseite
|
14 |
response = requests.get(url)
|
15 |
soup = BeautifulSoup(response.text, 'html.parser')
|
16 |
+
|
17 |
+
first_div = soup.find('div', class_='MjjYud')
|
18 |
+
|
19 |
+
if first_div:
|
20 |
+
return first_div.text.strip()
|
21 |
+
else:
|
22 |
+
print("Kein div mit der Klasse 'MjjYud' gefunden.")
|
23 |
+
return None
|
|
|
24 |
|
25 |
demo = gr.Interface(
|
26 |
fn=google_search,
|
27 |
inputs=gr.Textbox(lines=2, placeholder="Geben Sie Ihre Suchanfrage ein..."),
|
28 |
outputs="text",
|
29 |
+
title="google websearch",
|
30 |
+
description="Geben Sie eine Suchanfrage ein..."
|
31 |
)
|
32 |
|
33 |
+
demo.launch()
|