Spaces:
Runtime error
Runtime error
Commit
·
505f63b
1
Parent(s):
c725aeb
fix bug of wrong position of is_error param
Browse files- demo/chat_frontend.py +3 -3
- demo/generation_frontend.py +3 -3
demo/chat_frontend.py
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
# Email : zhangfan@baai.ac.cn
|
| 7 |
# Institute : Beijing Academy of Artificial Intelligence (BAAI)
|
| 8 |
# Create On : 2023-12-12 18:05
|
| 9 |
-
# Last Modified : 2023-12-
|
| 10 |
# File Name : chat_frontend.py
|
| 11 |
# Description :
|
| 12 |
#
|
|
@@ -131,9 +131,9 @@ def generate(
|
|
| 131 |
if content["code"] == 0:
|
| 132 |
meta.append(Role.ASSISTANT, DataMeta.build(text=content["data"]))
|
| 133 |
else:
|
| 134 |
-
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: {content['data']}"
|
| 135 |
else:
|
| 136 |
-
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: http failed with code {rsp.status_code}"
|
| 137 |
|
| 138 |
return meta.format_chatbot(), meta
|
| 139 |
|
|
|
|
| 6 |
# Email : zhangfan@baai.ac.cn
|
| 7 |
# Institute : Beijing Academy of Artificial Intelligence (BAAI)
|
| 8 |
# Create On : 2023-12-12 18:05
|
| 9 |
+
# Last Modified : 2023-12-20 05:25
|
| 10 |
# File Name : chat_frontend.py
|
| 11 |
# Description :
|
| 12 |
#
|
|
|
|
| 131 |
if content["code"] == 0:
|
| 132 |
meta.append(Role.ASSISTANT, DataMeta.build(text=content["data"]))
|
| 133 |
else:
|
| 134 |
+
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: {content['data']}", is_error=True))
|
| 135 |
else:
|
| 136 |
+
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: http failed with code {rsp.status_code}", is_error=True))
|
| 137 |
|
| 138 |
return meta.format_chatbot(), meta
|
| 139 |
|
demo/generation_frontend.py
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
# Email : zhangfan@baai.ac.cn
|
| 7 |
# Institute : Beijing Academy of Artificial Intelligence (BAAI)
|
| 8 |
# Create On : 2023-12-11 15:35
|
| 9 |
-
# Last Modified : 2023-12-20
|
| 10 |
# File Name : generation_frontend.py
|
| 11 |
# Description :
|
| 12 |
#
|
|
@@ -120,9 +120,9 @@ def generate(meta, classifier_free_guidance, steps):
|
|
| 120 |
image = Image.open(io.BytesIO(base64.b64decode(content["data"])))
|
| 121 |
meta.append(Role.ASSISTANT, DataMeta.build(image=image, resize=False))
|
| 122 |
else:
|
| 123 |
-
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: {content['data']}"))
|
| 124 |
else:
|
| 125 |
-
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: http failed with code {rsp.status_code}"))
|
| 126 |
|
| 127 |
return meta.format_chatbot(), meta
|
| 128 |
|
|
|
|
| 6 |
# Email : zhangfan@baai.ac.cn
|
| 7 |
# Institute : Beijing Academy of Artificial Intelligence (BAAI)
|
| 8 |
# Create On : 2023-12-11 15:35
|
| 9 |
+
# Last Modified : 2023-12-20 05:25
|
| 10 |
# File Name : generation_frontend.py
|
| 11 |
# Description :
|
| 12 |
#
|
|
|
|
| 120 |
image = Image.open(io.BytesIO(base64.b64decode(content["data"])))
|
| 121 |
meta.append(Role.ASSISTANT, DataMeta.build(image=image, resize=False))
|
| 122 |
else:
|
| 123 |
+
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: {content['data']}", is_error=True))
|
| 124 |
else:
|
| 125 |
+
meta.append(Role.ASSISTANT, DataMeta.build(text=f"GENERATE FAILED: http failed with code {rsp.status_code}", is_error=True))
|
| 126 |
|
| 127 |
return meta.format_chatbot(), meta
|
| 128 |
|