Update app.py
Browse files
app.py
CHANGED
@@ -50,17 +50,20 @@ def main(prompt):
|
|
50 |
}
|
51 |
|
52 |
response = requests.post(url, json=payload, headers=headers)
|
53 |
-
data = json.loads(response.text)
|
54 |
try:
|
55 |
-
data =
|
56 |
try:
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
59 |
return data
|
60 |
except:
|
61 |
-
return
|
62 |
except:
|
63 |
-
return "Error occured"
|
64 |
|
65 |
iface = gr.Interface(fn=main, inputs="text", outputs="text")
|
66 |
iface.launch()
|
|
|
50 |
}
|
51 |
|
52 |
response = requests.post(url, json=payload, headers=headers)
|
|
|
53 |
try:
|
54 |
+
data = json.loads(response.text)
|
55 |
try:
|
56 |
+
data = data["message"]
|
57 |
+
try:
|
58 |
+
if "ChatSonic" in data:
|
59 |
+
data = data.replace("ChatSonic","John")
|
60 |
+
return data
|
61 |
+
except:
|
62 |
return data
|
63 |
except:
|
64 |
+
return "Error occured!"
|
65 |
except:
|
66 |
+
return "Error occured!"
|
67 |
|
68 |
iface = gr.Interface(fn=main, inputs="text", outputs="text")
|
69 |
iface.launch()
|