Commit
•
53ba35d
1
Parent(s):
c8464bf
Update app.py
Browse files
app.py
CHANGED
@@ -70,10 +70,13 @@ def predict(message, history):
|
|
70 |
# Check if the request was successful
|
71 |
if response.status_code == 200:
|
72 |
# Print the content of the response (the data the server returned)
|
73 |
-
|
|
|
|
|
74 |
else:
|
75 |
# Print an error message if something went wrong
|
76 |
-
|
77 |
-
|
|
|
78 |
|
79 |
gr.ChatInterface(predict).launch()
|
|
|
70 |
# Check if the request was successful
|
71 |
if response.status_code == 200:
|
72 |
# Print the content of the response (the data the server returned)
|
73 |
+
response_json = response.json()
|
74 |
+
translation_text = response_json[0]['translation_text']
|
75 |
+
return translation_text
|
76 |
else:
|
77 |
# Print an error message if something went wrong
|
78 |
+
return "Sorry I could not answer your question as something went wrong"
|
79 |
+
#print(f"Request failed with status code {response.status_code}: {response.text}")
|
80 |
+
return "Sorry I could not answer your question as something went wrong"
|
81 |
|
82 |
gr.ChatInterface(predict).launch()
|