Thiloid commited on
Commit
314a9f3
·
verified ·
1 Parent(s): befcfd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -19
app.py CHANGED
@@ -107,25 +107,38 @@ dropdown_options = ["Keine These ausgewählt",
107
  'Der Flugverkehr soll höher besteuert werden.',
108
  'Unternehmen sollen selbst entscheiden, ob sie ihren Beschäftigten das Arbeiten im Homeoffice erlauben.']
109
 
110
- app_title = "Avah: Artificial Voting Advice Helper"
111
- with gr.Blocks(app_title=app_title) as demo:
112
- chatbot = gr.Chatbot(value=[[None, "Hallo mein Name ist Avah (Artificial Voting Advice Helper), deine interaktive Hilfe zum Wahl-O-Maten für die Bundestagswahl 2021. Wenn du Fragen zu Thesen der Wahlhilfe hast, wähle gerne die besagt These aus. Ansonsten kannst du mir auch unabhängig von bestimmten Thesen Fragen stellen."]], render_markdown=True)
113
- dropdown = gr.Dropdown(choices=dropdown_options, label="Wähle eine These aus wenn du willst")
114
- textbox = gr.Textbox(label="Deine Frage")
115
-
116
- def combined_response(prompt, history, dropdown_value):
117
- answer = response(prompt, history, dropdown_value)
118
- return history + [[prompt, answer]]
119
-
120
- submit_button = gr.Button("Submit")
121
-
122
- submit_button.click(
123
- combined_response,
124
- inputs=[textbox, chatbot, dropdown],
125
- outputs=chatbot,
126
- )
127
-
128
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  print("Interface up and running!")
131
 
 
107
  'Der Flugverkehr soll höher besteuert werden.',
108
  'Unternehmen sollen selbst entscheiden, ob sie ihren Beschäftigten das Arbeiten im Homeoffice erlauben.']
109
 
110
+ chatbot = gr.Chatbot(value=[[None, "Hallo mein Name ist Avah (Artificial Voting Advice Helper), deine interaktive Hilfe zum Wahl-O-Maten für die Bundestagswahl 2021. Wenn du Fragen zu Thesen der Wahlhilfe hast, wähle gerne die besagt These aus. Ansonsten kannst du mir auch unabhängig von bestimmten Thesen Fragen stellen."]], render_markdown=True)
111
+
112
+ dropdown = gr.Dropdown(choices=dropdown_options, label="Wähle eine These aus, wenn du willst")
113
+
114
+ textbox = gr.Textbox(label="Deine Frage")
115
+
116
+ # Function to handle submit button click
117
+ def combined_response(prompt, history, dropdown_value):
118
+ # Replace response with your actual response handling function
119
+ answer = response(prompt, history, dropdown_value)
120
+ return history + [[prompt, answer]]
121
+
122
+ submit_button = gr.Button("Submit")
123
+
124
+ # Set up the GUI layout
125
+ layout = gr.Blocks(
126
+ gr.Label("Title of Your Application", size="h3"), # Adding a title
127
+ chatbot,
128
+ dropdown,
129
+ textbox,
130
+ submit_button,
131
+ )
132
+
133
+ # Define the click behavior for the submit button
134
+ submit_button.click(
135
+ combined_response,
136
+ inputs=[textbox, chatbot, dropdown],
137
+ outputs=chatbot,
138
+ )
139
+
140
+ # Launch the GUI
141
+ layout.launch()
142
 
143
  print("Interface up and running!")
144