Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -351,11 +351,14 @@ def generate(text, history, rag_option, model_option, k=3, top_p=0.6, temperatu
|
|
351 |
"options": {"max_new_tokens": max_new_tokens},
|
352 |
}
|
353 |
response= requests.post(API_URL, headers=HEADERS, json=data)
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
|
|
|
|
|
|
359 |
except Exception as e:
|
360 |
raise gr.Error(e)
|
361 |
|
|
|
351 |
"options": {"max_new_tokens": max_new_tokens},
|
352 |
}
|
353 |
response= requests.post(API_URL, headers=HEADERS, json=data)
|
354 |
+
if response != None:
|
355 |
+
result = response.json()
|
356 |
+
print("result:------------------")
|
357 |
+
chatbot_response = result[0]['generated_text']
|
358 |
+
print("anzahl tokens gesamt antwort:------------------")
|
359 |
+
print (len(chatbot_response.split()))
|
360 |
+
else:
|
361 |
+
chatbot_response = "Weiß ich nicht!"
|
362 |
except Exception as e:
|
363 |
raise gr.Error(e)
|
364 |
|