ceckenrode commited on
Commit
d33f8dd
·
1 Parent(s): 5b584ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -199,6 +199,20 @@ with gr.Blocks(css = """#col_container {width: 1400px; margin-left: auto; margin
199
  deleteFile.click(delete_file, inputs=fileName, outputs=completedMessage)
200
  appendFile.click(append_file, inputs=[fileName, fileContent], outputs=completedMessage )
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  inputs.submit(predict, [inputs, top_p, temperature,chat_counter, chatbot, state], [chatbot, state, chat_counter])
203
  b1.click(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter])
204
  b1.click(reset_textbox, [], [inputs])
 
199
  deleteFile.click(delete_file, inputs=fileName, outputs=completedMessage)
200
  appendFile.click(append_file, inputs=[fileName, fileContent], outputs=completedMessage )
201
 
202
+
203
+ def download_csv(df):
204
+ return gr.outputs.File(csv_data=df.to_csv(index=False), label="Download CSV")
205
+
206
+ iface = gr.Interface(
207
+ fn=download_csv,
208
+ inputs=gr.inputs.Dataframe(headers=["col1", "col2"]),
209
+ outputs="file",
210
+ title="Download CSV",
211
+ description="Converts a pandas dataframe to a CSV file and allows it to be downloaded.",
212
+ theme="light",
213
+ )
214
+ iface.launch()
215
+
216
  inputs.submit(predict, [inputs, top_p, temperature,chat_counter, chatbot, state], [chatbot, state, chat_counter])
217
  b1.click(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter])
218
  b1.click(reset_textbox, [], [inputs])