Update app.py
Browse files
app.py
CHANGED
|
@@ -123,18 +123,22 @@ dropdown_options = ["Keine These ausgewählt",
|
|
| 123 |
|
| 124 |
|
| 125 |
with gr.Blocks() as demo:
|
| 126 |
-
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)
|
| 127 |
dropdown = gr.Dropdown(choices=dropdown_options, label="Choose an option")
|
| 128 |
textbox = gr.Textbox(label="Your Question")
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
inputs=[textbox, chatbot, dropdown],
|
| 133 |
outputs=chatbot,
|
| 134 |
-
title="Avah (Artificial Voting Advice Helper)"
|
| 135 |
)
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
|
| 140 |
print("Interface up and running!")
|
|
|
|
| 123 |
|
| 124 |
|
| 125 |
with gr.Blocks() as demo:
|
| 126 |
+
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)
|
| 127 |
dropdown = gr.Dropdown(choices=dropdown_options, label="Choose an option")
|
| 128 |
textbox = gr.Textbox(label="Your Question")
|
| 129 |
|
| 130 |
+
def combined_response(prompt, history, dropdown_value):
|
| 131 |
+
return response(prompt, history, dropdown_value)
|
| 132 |
+
|
| 133 |
+
submit_button = gr.Button("Submit")
|
| 134 |
+
|
| 135 |
+
submit_button.click(
|
| 136 |
+
combined_response,
|
| 137 |
inputs=[textbox, chatbot, dropdown],
|
| 138 |
outputs=chatbot,
|
|
|
|
| 139 |
)
|
| 140 |
|
| 141 |
+
demo.launch(share=True)
|
| 142 |
|
| 143 |
|
| 144 |
print("Interface up and running!")
|