Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -301,14 +301,15 @@ def generate(text, history, rag_option, model_option, temperature=0.5, max_new_
|
|
301 |
#print("result:------------------")
|
302 |
#print(result[0]['generated_text'])
|
303 |
if response.status_code == 200:
|
304 |
-
|
305 |
else:
|
306 |
raise Exception(f"Request failed with status code {response.status_code}: {response.text}")
|
307 |
|
308 |
except Exception as e:
|
309 |
raise gr.Error(e)
|
310 |
|
311 |
-
|
|
|
312 |
|
313 |
#Antwort als Stream ausgeben...
|
314 |
#for i in range(len(result)):
|
|
|
301 |
#print("result:------------------")
|
302 |
#print(result[0]['generated_text'])
|
303 |
if response.status_code == 200:
|
304 |
+
chatbot_response = json.loads(response.text)["generated_text"]
|
305 |
else:
|
306 |
raise Exception(f"Request failed with status code {response.status_code}: {response.text}")
|
307 |
|
308 |
except Exception as e:
|
309 |
raise gr.Error(e)
|
310 |
|
311 |
+
chatbot_message = chatbot_response[len(prompt):].strip()
|
312 |
+
return chatbot_message #result[0]['generated_text']
|
313 |
|
314 |
#Antwort als Stream ausgeben...
|
315 |
#for i in range(len(result)):
|