ajitrajasekharan commited on
Commit
d4804d5
1 Parent(s): 0a7c967

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -78,15 +78,20 @@ try:
78
  label="Original text",
79
  value=default_text,
80
  )
81
- start = time.time()
82
- res = get_bert_prediction(input_text,top_k)
 
 
 
83
 
84
 
85
- st.header("JSON:")
86
 
87
- st.json(res)
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 occured!" + str(e))
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("---")