blind1234 commited on
Commit
4662992
·
verified ·
1 Parent(s): a122c34

Update app.py

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