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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -19
app.py CHANGED
@@ -107,38 +107,41 @@ 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
  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
 
 
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
+ with gr.Blocks(title= "test") as demo:
111
+
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
 
114
+ dropdown = gr.Dropdown(choices=dropdown_options, label="Wähle eine These aus wenn du willst")
115
 
116
  textbox = gr.Textbox(label="Deine Frage")
117
 
118
+
119
+
120
  def combined_response(prompt, history, dropdown_value):
121
+
122
+ answer = response(prompt, history, dropdown_value)
123
+
124
+ return history + [[prompt, answer]]
125
+
126
+
127
 
128
  submit_button = gr.Button("Submit")
129
 
 
 
 
 
 
 
 
 
130
 
131
+
132
  submit_button.click(
133
+
134
+ combined_response,
135
+
136
+ inputs=[textbox, chatbot, dropdown],
137
+
138
+ outputs=chatbot,
139
+
140
  )
141
 
142
+
143
+
144
+ demo.launch()
145
 
146
  print("Interface up and running!")
147