RamAnanth1 commited on
Commit
ac0df45
1 Parent(s): a12dda5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -50,7 +50,7 @@ accepted_venues = ['ICLR 2023 poster', 'ICLR 2023 notable top 5%', 'ICLR 2023 no
50
  df = df_raw[df_raw["content.venue"].isin(accepted_venues)]
51
  st.write("Number of submissions accepted at ICLR 2023:", len(df))
52
 
53
- df_filtered = df[['id', 'content.title', 'content.keywords', 'content.abstract']]
54
  df = df_filtered
55
  if "CO_API_KEY" not in os.environ:
56
  raise KeyError("CO_API_KEY not found in st.secrets or os.environ. Please set it in "
@@ -58,7 +58,24 @@ if "CO_API_KEY" not in os.environ:
58
 
59
  co = cohere.Client(os.environ["CO_API_KEY"])
60
 
 
 
 
 
 
 
 
 
 
 
61
  def get_visualizations():
 
 
 
 
 
 
 
62
  list_of_titles = list(df["content.title"].values)
63
  embeds = co.embed(texts=list_of_titles,
64
  model="small").embeddings
@@ -87,5 +104,8 @@ def get_visualizations():
87
  fig2 = topic_model.visualize_barchart(custom_labels=True)
88
  st.plotly_chart(fig1)
89
  st.plotly_chart(fig2)
 
 
 
90
 
91
  st.button("Run Visualization", on_click=get_visualizations)
 
50
  df = df_raw[df_raw["content.venue"].isin(accepted_venues)]
51
  st.write("Number of submissions accepted at ICLR 2023:", len(df))
52
 
53
+ df_filtered = df[['content.title', 'content.keywords', 'content.abstract', 'content.venue']]
54
  df = df_filtered
55
  if "CO_API_KEY" not in os.environ:
56
  raise KeyError("CO_API_KEY not found in st.secrets or os.environ. Please set it in "
 
58
 
59
  co = cohere.Client(os.environ["CO_API_KEY"])
60
 
61
+ def to_html(df: pd.DataFrame, table_header: str) -> str:
62
+ table_data = ''.join(df.html_table_content)
63
+ html = f'''
64
+ <table>
65
+ {table_header}
66
+ {table_data}
67
+ </table>'''
68
+ return html
69
+
70
+
71
  def get_visualizations():
72
+ table_header = '''
73
+ <tr>
74
+ <td width="25%">Title</td>
75
+ <td width="15%">Keywords</td>
76
+ <td width="10%">Venue</td>
77
+ <td width="50%">Abstract</td>
78
+ </tr>'''
79
  list_of_titles = list(df["content.title"].values)
80
  embeds = co.embed(texts=list_of_titles,
81
  model="small").embeddings
 
104
  fig2 = topic_model.visualize_barchart(custom_labels=True)
105
  st.plotly_chart(fig1)
106
  st.plotly_chart(fig2)
107
+ st.write("Full List of Papers")
108
+ to_html(df,table_header)
109
+
110
 
111
  st.button("Run Visualization", on_click=get_visualizations)