wzkariampuzha commited on
Commit
0d9531e
1 Parent(s): c6171a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -62,6 +62,24 @@ def load_models():
62
  GARD_dict, max_length = extract_abs.load_GARD_diseases()
63
  return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  with st.spinner('Loading Epidemiology Models and Dependencies...'):
66
  classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length = load_models_experimental()
67
  #classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length = load_models()
@@ -84,7 +102,6 @@ if disease_or_gard_id:
84
  extract_diseases,GARD_dict, max_length,
85
  classify_model_vars)
86
  st.dataframe(df, height=100)
87
- csv = convert_df(df)
88
  st.download_button(
89
  label="Download epidemiology results for "+disease_or_gard_id+" as CSV",
90
  data=df.to_csv().encode('utf-8'),
@@ -95,5 +112,7 @@ if disease_or_gard_id:
95
  gathered, relevant, epidemiologic = sankey_data
96
  if st.button('Display Sankey Diagram'):
97
  st.write('Sankey Diagram here')
 
 
98
  pass
99
  # st.code(body, language="python")
 
62
  GARD_dict, max_length = extract_abs.load_GARD_diseases()
63
  return classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length
64
 
65
+ def epi_sankey(sankey_data):
66
+ gathered, relevant, epidemiologic = sankey_data
67
+ fig = go.Figure(data=[go.Sankey(
68
+ node = dict(
69
+ pad = 15,
70
+ thickness = 20,
71
+ line = dict(color = "black", width = 0.5),
72
+ label = ["PubMed IDs Gathered", "Relevant Abstracts Gathered", "Irrelevant", "Epidemiologic", "Irrelevant"],
73
+ color = "blue"
74
+ ),
75
+ #label = ["A1", "A2", "B1", "B2", "C1", "C2"]
76
+ link = dict(
77
+ source = [0, 0, 0, 1, 3]
78
+ target = [0, 1, 2, 3, 4],
79
+ value = [gathered, gathered-relevant, relevant, epidemiologic, gathered-epidemiologic]
80
+ ))])
81
+ return fig
82
+
83
  with st.spinner('Loading Epidemiology Models and Dependencies...'):
84
  classify_model_vars, NER_pipeline, entity_classes, GARD_dict, max_length = load_models_experimental()
85
  #classify_tokenizer, classify_model, NER_pipeline, entity_classes, GARD_dict, max_length = load_models()
 
102
  extract_diseases,GARD_dict, max_length,
103
  classify_model_vars)
104
  st.dataframe(df, height=100)
 
105
  st.download_button(
106
  label="Download epidemiology results for "+disease_or_gard_id+" as CSV",
107
  data=df.to_csv().encode('utf-8'),
 
112
  gathered, relevant, epidemiologic = sankey_data
113
  if st.button('Display Sankey Diagram'):
114
  st.write('Sankey Diagram here')
115
+ #fig = epi_sankey(sankey_data)
116
+ #st.plotly_chart(fig, use_container_width=True)
117
  pass
118
  # st.code(body, language="python")