Update src/interface.py
Browse files- src/interface.py +16 -0
src/interface.py
CHANGED
|
@@ -74,6 +74,22 @@ def create_demo():
|
|
| 74 |
with gr.Column(scale=0.20):
|
| 75 |
uploaded_pdf = gr.UploadButton("📁 Upload PDF", file_types=[".pdf"], elem_id='upload_pdf')
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
return demo, chat_history, show_img, text_input, submit_button, uploaded_pdf, slider_chunk_size,slider_overlap_percentage,slider_temp,slider_k
|
| 78 |
|
| 79 |
if __name__ == '__main__':
|
|
|
|
| 74 |
with gr.Column(scale=0.20):
|
| 75 |
uploaded_pdf = gr.UploadButton("📁 Upload PDF", file_types=[".pdf"], elem_id='upload_pdf')
|
| 76 |
|
| 77 |
+
# Define the Gradio interface
|
| 78 |
+
iface = Interface(
|
| 79 |
+
fn=export_conversations,
|
| 80 |
+
inputs="conversations",
|
| 81 |
+
outputs=Output.File(type="csv"),
|
| 82 |
+
title="Export Conversations",
|
| 83 |
+
description="Export conversations as a CSV file"
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
# Add a download button to trigger the export
|
| 87 |
+
download_button = Button("Download Conversations as CSV")
|
| 88 |
+
|
| 89 |
+
# Add the components to the interface
|
| 90 |
+
iface.launch(inputs=["conversations"], outputs="file", api_name="export_conversations", api_open_browser=False, flagging_callback=None, analytics_enabled=False, enable_queue=True, show_error=True, allow_screenshot=True, allow_flagging=True)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
return demo, chat_history, show_img, text_input, submit_button, uploaded_pdf, slider_chunk_size,slider_overlap_percentage,slider_temp,slider_k
|
| 94 |
|
| 95 |
if __name__ == '__main__':
|