ajitrajasekharan
commited on
Commit
•
d4804d5
1
Parent(s):
0a7c967
Update app.py
Browse files
app.py
CHANGED
@@ -78,15 +78,20 @@ try:
|
|
78 |
label="Original text",
|
79 |
value=default_text,
|
80 |
)
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
83 |
|
84 |
|
85 |
-
|
86 |
|
87 |
-
|
88 |
|
89 |
-
|
|
|
|
|
90 |
|
91 |
|
92 |
|
@@ -94,7 +99,7 @@ try:
|
|
94 |
st.text(f"prediction took {time.time() - start:.2f}s")
|
95 |
|
96 |
except Exception as e:
|
97 |
-
st.error("Some error
|
98 |
st.stop()
|
99 |
|
100 |
st.write("---")
|
|
|
78 |
label="Original text",
|
79 |
value=default_text,
|
80 |
)
|
81 |
+
if st.button("Submit"):
|
82 |
+
with st.spinner("Computing"):
|
83 |
+
start = time.time()
|
84 |
+
try:
|
85 |
+
res = get_bert_prediction(input_text,top_k)
|
86 |
|
87 |
|
88 |
+
st.header("JSON:")
|
89 |
|
90 |
+
st.json(res)
|
91 |
|
92 |
+
except Exception as e:
|
93 |
+
st.error("Some error occurred during prediction" + str(e))
|
94 |
+
st.stop()
|
95 |
|
96 |
|
97 |
|
|
|
99 |
st.text(f"prediction took {time.time() - start:.2f}s")
|
100 |
|
101 |
except Exception as e:
|
102 |
+
st.error("Some error occurred during loading" + str(e))
|
103 |
st.stop()
|
104 |
|
105 |
st.write("---")
|