Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
# Function to handle user feedback submission
|
3 |
def submit_feedback(message):
|
4 |
-
#
|
5 |
-
|
|
|
6 |
return "Feedback submitted successfully!"
|
7 |
-
#
|
8 |
-
feedback_list = []
|
9 |
-
# Create the Gradio interface
|
10 |
with gr.Blocks() as demo:
|
11 |
-
# Textbox for user input
|
12 |
-
|
13 |
# Button to submit feedback
|
14 |
-
submit_button = gr.Button("Submit")
|
15 |
-
# Textbox to display the result
|
16 |
-
|
17 |
# Set up the event listener for the submit button
|
18 |
-
submit_button.click(fn=submit_feedback, inputs=
|
19 |
# Launch the Gradio app
|
20 |
demo.launch(show_error=True)
|
|
|
1 |
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
# Function to handle user feedback submission
|
4 |
def submit_feedback(message):
|
5 |
+
# Append the message to the user feedback DataFrame
|
6 |
+
user_feedback = pd.DataFrame({"message": [message]})
|
7 |
+
user_feedback.to_csv("user_feedback.csv", mode='a', header=False, index=False)
|
8 |
return "Feedback submitted successfully!"
|
9 |
+
# Create a Gradio interface for submitting feedback
|
|
|
|
|
10 |
with gr.Blocks() as demo:
|
11 |
+
# Textbox for user to input feedback
|
12 |
+
feedback_input = gr.Textbox(label="Your Feedback")
|
13 |
# Button to submit feedback
|
14 |
+
submit_button = gr.Button("Submit Feedback")
|
15 |
+
# Textbox to display the result of the submission
|
16 |
+
feedback_output = gr.Textbox(label="Result")
|
17 |
# Set up the event listener for the submit button
|
18 |
+
submit_button.click(fn=submit_feedback, inputs=feedback_input, outputs=feedback_output)
|
19 |
# Launch the Gradio app
|
20 |
demo.launch(show_error=True)
|