Spaces:
Runtime error
Runtime error
add error messsage if still loading
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ top_k = st.sidebar.text_input(
|
|
73 |
|
74 |
top_p = st.sidebar.text_input(
|
75 |
"Top p",
|
76 |
-
value=
|
77 |
help=" If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation."
|
78 |
)
|
79 |
|
@@ -105,8 +105,12 @@ if st.button("Run"):
|
|
105 |
temp=temp,
|
106 |
top_k=int(top_k),
|
107 |
top_p=float(top_p))
|
|
|
108 |
print("result:", result)
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
73 |
|
74 |
top_p = st.sidebar.text_input(
|
75 |
"Top p",
|
76 |
+
value=0.95,
|
77 |
help=" If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation."
|
78 |
)
|
79 |
|
|
|
105 |
temp=temp,
|
106 |
top_k=int(top_k),
|
107 |
top_p=float(top_p))
|
108 |
+
|
109 |
print("result:", result)
|
110 |
+
if "error" in result:
|
111 |
+
st.write(f'{result["error"]}. Please try it again in about {result["estimated_time"]:.0f} seconds')
|
112 |
+
else:
|
113 |
+
result = result[0]["generated_text"]
|
114 |
+
st.write(result.replace("\n", " \n"))
|
115 |
+
st.text("English translation")
|
116 |
+
st.write(translate(result, "en", "id").replace("\n", " \n"))
|