vaibhavsharda commited on
Commit
ed5c0c4
·
1 Parent(s): 934b99e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -42,8 +42,8 @@ def get_views(action):
42
  if ("view_count" not in st.session_state):
43
  try:
44
  app_info = {'name': APP_NAME,"action":action,"host":hostname,"ip":ip_address}
45
- res = requests.post(INFO_URL, json = app_info).json()
46
- print(res)
47
  data = res["count"]
48
  except:
49
  data = 0
@@ -53,7 +53,7 @@ def get_views(action):
53
  ret_val = st.session_state["view_count"]
54
  if (action != "init"):
55
  app_info = {'name': APP_NAME,"action":action,"host":hostname,"ip":ip_address}
56
- res = requests.post(INFO_URL, json = app_info).json()
57
  return "{:,}".format(ret_val)
58
 
59
 
@@ -245,6 +245,14 @@ def app_main(app_mode,example_files,model_name_files,clus_types):
245
  options = list(dict.keys(cluster_types)), index=0, key = "twc_cluster_types")
246
  st.write("")
247
  submit_button = st.form_submit_button('Run')
 
 
 
 
 
 
 
 
248
 
249
 
250
  input_status_area = st.empty()
@@ -280,14 +288,7 @@ def app_main(app_mode,example_files,model_name_files,clus_types):
280
  st.info("Custom model overrides model selection in step 2 above. So please clear the custom model text box to choose models from step 2")
281
  display_results(sentences,results,response_info,app_mode,run_model)
282
  #st.json(results)
283
- st.download_button(
284
- label="Download results as json",
285
- data= st.session_state["download_ready"] if st.session_state["download_ready"] != None else "",
286
- disabled = False if st.session_state["download_ready"] != None else True,
287
- file_name= (st.session_state["model_name"] + "_" + str(st.session_state["threshold"]) + "_" + st.session_state["overlapped"] + "_" + '_'.join(st.session_state["file_name"].split(".")[:-1]) + ".json").replace("/","_"),
288
- mime='text/json',
289
- key ="download"
290
- )
291
 
292
 
293
 
 
42
  if ("view_count" not in st.session_state):
43
  try:
44
  app_info = {'name': APP_NAME,"action":action,"host":hostname,"ip":ip_address}
45
+ #res = requests.post(INFO_URL, json = app_info).json()
46
+ #print(res)
47
  data = res["count"]
48
  except:
49
  data = 0
 
53
  ret_val = st.session_state["view_count"]
54
  if (action != "init"):
55
  app_info = {'name': APP_NAME,"action":action,"host":hostname,"ip":ip_address}
56
+ #res = requests.post(INFO_URL, json = app_info).json()
57
  return "{:,}".format(ret_val)
58
 
59
 
 
245
  options = list(dict.keys(cluster_types)), index=0, key = "twc_cluster_types")
246
  st.write("")
247
  submit_button = st.form_submit_button('Run')
248
+ st.download_button(
249
+ label="Download results as json",
250
+ data= st.session_state["download_ready"] if st.session_state["download_ready"] != None else "",
251
+ disabled = False if st.session_state["download_ready"] != None else True,
252
+ file_name= (st.session_state["model_name"] + "_" + str(st.session_state["threshold"]) + "_" + st.session_state["overlapped"] + "_" + '_'.join(st.session_state["file_name"].split(".")[:-1]) + ".json").replace("/","_"),
253
+ mime='text/json',
254
+ key ="download"
255
+ )
256
 
257
 
258
  input_status_area = st.empty()
 
288
  st.info("Custom model overrides model selection in step 2 above. So please clear the custom model text box to choose models from step 2")
289
  display_results(sentences,results,response_info,app_mode,run_model)
290
  #st.json(results)
291
+
 
 
 
 
 
 
 
292
 
293
 
294