Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,8 +23,8 @@ def save_to_csv(appointment_timing, services, products, contact, customer_name,
|
|
| 23 |
date = datetime.now().strftime("%Y-%m-%d")
|
| 24 |
appointment = len(df) + 1 # Generate appointment ID
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
new_row = {
|
| 28 |
"Date": date,
|
| 29 |
"Appointment": appointment,
|
| 30 |
"Appointment Timing": appointment_timing,
|
|
@@ -36,9 +36,11 @@ def save_to_csv(appointment_timing, services, products, contact, customer_name,
|
|
| 36 |
"Location": location,
|
| 37 |
"Key-points": key_points,
|
| 38 |
"Price": price
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
return f"Data saved successfully for Appointment {appointment}!"
|
| 43 |
|
| 44 |
# Define Gradio interface
|
|
@@ -69,4 +71,4 @@ with gr.Blocks() as app:
|
|
| 69 |
)
|
| 70 |
|
| 71 |
# Launch the application
|
| 72 |
-
app.launch()
|
|
|
|
| 23 |
date = datetime.now().strftime("%Y-%m-%d")
|
| 24 |
appointment = len(df) + 1 # Generate appointment ID
|
| 25 |
|
| 26 |
+
# Create a new row as a DataFrame
|
| 27 |
+
new_row = pd.DataFrame([{
|
| 28 |
"Date": date,
|
| 29 |
"Appointment": appointment,
|
| 30 |
"Appointment Timing": appointment_timing,
|
|
|
|
| 36 |
"Location": location,
|
| 37 |
"Key-points": key_points,
|
| 38 |
"Price": price
|
| 39 |
+
}])
|
| 40 |
+
|
| 41 |
+
# Concatenate the new row with the existing DataFrame
|
| 42 |
+
df = pd.concat([df, new_row], ignore_index=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 |
# Define Gradio interface
|
|
|
|
| 71 |
)
|
| 72 |
|
| 73 |
# Launch the application
|
| 74 |
+
app.launch(share=True) # Enable public link generation
|