Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -42,15 +42,15 @@ def perform_search(prompt):
|
|
42 |
response.raise_for_status() # Wirft eine Exception, wenn die Anfrage fehlschlägt
|
43 |
|
44 |
# JSON-Antwort parsen
|
45 |
-
data = response.
|
46 |
-
|
47 |
# Extrahiere die Suchergebnisse
|
48 |
items = data.get('items', [])
|
49 |
results = [item['snippet'] for item in items]
|
50 |
|
51 |
# Kombiniere die Ergebnisse zu einem String
|
52 |
result_text = '\n'.join(results)
|
53 |
-
|
54 |
# Formuliere die Antwort
|
55 |
search_query = f"{prompt} antworte kurz und knapp. antworte auf deutsch. du findest die antwort hier: {result_text}"
|
56 |
result = predict(search_query)
|
|
|
42 |
response.raise_for_status() # Wirft eine Exception, wenn die Anfrage fehlschlägt
|
43 |
|
44 |
# JSON-Antwort parsen
|
45 |
+
data = response.json()
|
46 |
+
|
47 |
# Extrahiere die Suchergebnisse
|
48 |
items = data.get('items', [])
|
49 |
results = [item['snippet'] for item in items]
|
50 |
|
51 |
# Kombiniere die Ergebnisse zu einem String
|
52 |
result_text = '\n'.join(results)
|
53 |
+
return result_text
|
54 |
# Formuliere die Antwort
|
55 |
search_query = f"{prompt} antworte kurz und knapp. antworte auf deutsch. du findest die antwort hier: {result_text}"
|
56 |
result = predict(search_query)
|