Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,6 +43,10 @@ def save_to_csv(appointment_timing, services, products, contact, customer_name,
|
|
43 |
df.to_csv(STORAGE_PATH, index=False) # Save the updated DataFrame to the CSV file
|
44 |
return f"Data saved successfully for Appointment {appointment}!"
|
45 |
|
|
|
|
|
|
|
|
|
46 |
# Define Gradio interface
|
47 |
with gr.Blocks() as app:
|
48 |
gr.Markdown("# Appointment Data Storage Application")
|
@@ -61,6 +65,7 @@ with gr.Blocks() as app:
|
|
61 |
price = gr.Dropdown(label="Price", choices=["999", "1499", "2499", "3499", "4499"])
|
62 |
submit_button = gr.Button("Submit")
|
63 |
output = gr.Textbox(label="Output")
|
|
|
64 |
|
65 |
submit_button.click(
|
66 |
save_to_csv,
|
@@ -70,5 +75,8 @@ with gr.Blocks() as app:
|
|
70 |
outputs=output
|
71 |
)
|
72 |
|
|
|
|
|
|
|
73 |
# Launch the application
|
74 |
-
app.launch(share=True)
|
|
|
43 |
df.to_csv(STORAGE_PATH, index=False) # Save the updated DataFrame to the CSV file
|
44 |
return f"Data saved successfully for Appointment {appointment}!"
|
45 |
|
46 |
+
# Function to provide the download file
|
47 |
+
def get_csv_file():
|
48 |
+
return STORAGE_PATH
|
49 |
+
|
50 |
# Define Gradio interface
|
51 |
with gr.Blocks() as app:
|
52 |
gr.Markdown("# Appointment Data Storage Application")
|
|
|
65 |
price = gr.Dropdown(label="Price", choices=["999", "1499", "2499", "3499", "4499"])
|
66 |
submit_button = gr.Button("Submit")
|
67 |
output = gr.Textbox(label="Output")
|
68 |
+
download_button = gr.File(label="Download Appointments Data", value=STORAGE_PATH)
|
69 |
|
70 |
submit_button.click(
|
71 |
save_to_csv,
|
|
|
75 |
outputs=output
|
76 |
)
|
77 |
|
78 |
+
# Add a file download button
|
79 |
+
download_button.render()
|
80 |
+
|
81 |
# Launch the application
|
82 |
+
app.launch(share=True)
|