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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
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
- # Store the message in a list (for simplicity, in a real app, this would be a database)
5
- feedback_list.append(message)
 
6
  return "Feedback submitted successfully!"
7
- # Initialize a list to store feedback messages
8
- feedback_list = []
9
- # Create the Gradio interface
10
  with gr.Blocks() as demo:
11
- # Textbox for user input
12
- message_input = gr.Textbox(label="Enter your feedback")
13
  # Button to submit feedback
14
- submit_button = gr.Button("Submit")
15
- # Textbox to display the result
16
- result_output = gr.Textbox(label="Result")
17
  # Set up the event listener for the submit button
18
- submit_button.click(fn=submit_feedback, inputs=message_input, outputs=result_output)
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)