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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -28
app.py CHANGED
@@ -1,30 +1,20 @@
1
  import gradio as gr
2
-
3
  # Function to handle user feedback submission
4
- def submit_feedback(message):
5
- # Store the message in a list (for simplicity, in a real app, this would be a database)
6
- feedback.append(message)
7
- return "Message submitted successfully!"
8
-
9
- # Function to handle admin login
10
- def admin_login(username, password):
11
- # For simplicity, we are using a hardcoded username and password
12
- if username == "admin" and password == "admin123":
13
- return True
14
- else:
15
- return False
16
-
17
- # Function to handle account creation by admin
18
- def create_account(username, password):
19
- # For simplicity, we are using a list to store user accounts (in a real app, this would be a database)
20
- if username in users:
21
- return "Username already exists!"
22
- users[username] = password
23
- return "Account created successfully!"
24
-
25
- # Initialize user accounts and feedback list
26
- users = {}
27
- feedback = []
28
-
29
- # Define the Gradio interface for user feedback submission
30
- with gr.Blocks() as
 
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)