Shrikrishna commited on
Commit
e348353
·
1 Parent(s): 6fda1fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -94,6 +94,9 @@ def extract_structured_data(content: str, data_points):
94
 
95
  return results
96
 
 
 
 
97
  # 5. Streamlit app
98
  def main():
99
  default_data_points = """{
@@ -141,6 +144,13 @@ def main():
141
  df = pd.DataFrame(results)
142
  st.subheader("Results")
143
  st.data_editor(df)
 
 
 
 
 
 
 
144
  except Exception as e:
145
  st.error(
146
  f"An error occurred while creating the DataFrame: {e}")
 
94
 
95
  return results
96
 
97
+ def convert_df(df):
98
+ return df.to_csv(index=False).encode('utf-8')
99
+
100
  # 5. Streamlit app
101
  def main():
102
  default_data_points = """{
 
144
  df = pd.DataFrame(results)
145
  st.subheader("Results")
146
  st.data_editor(df)
147
+ st.download_button(
148
+ "Press to Download",
149
+ convert_df(df),
150
+ "file.csv",
151
+ "text/csv",
152
+ key='download-csv'
153
+ )
154
  except Exception as e:
155
  st.error(
156
  f"An error occurred while creating the DataFrame: {e}")