Spaces:
Runtime error
Runtime error
add error messsage if still loading
Browse files
app.py
CHANGED
|
@@ -108,7 +108,12 @@ if st.button("Run"):
|
|
| 108 |
|
| 109 |
print("result:", result)
|
| 110 |
if "error" in result:
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
else:
|
| 113 |
result = result[0]["generated_text"]
|
| 114 |
st.write(result.replace("\n", " \n"))
|
|
|
|
| 108 |
|
| 109 |
print("result:", result)
|
| 110 |
if "error" in result:
|
| 111 |
+
if type(result["error"]) is str:
|
| 112 |
+
st.write(f'{result["error"]}. Please try it again in about {result["estimated_time"]:.0f} seconds')
|
| 113 |
+
else:
|
| 114 |
+
if type(result["error"]) is list:
|
| 115 |
+
for error in result["error"]:
|
| 116 |
+
st.write(f'{error}')
|
| 117 |
else:
|
| 118 |
result = result[0]["generated_text"]
|
| 119 |
st.write(result.replace("\n", " \n"))
|