Spaces:
Build error
Build error
Hide version dropdown
Browse files
app.py
CHANGED
|
@@ -48,8 +48,9 @@ def remove_doc(btn, bot):
|
|
| 48 |
return [*new_accordions, *new_texts, bot]
|
| 49 |
|
| 50 |
|
| 51 |
-
def get_answer(message, history, session_id,
|
| 52 |
s = session_id
|
|
|
|
| 53 |
if celex_type == Versions.JUSTICE.value:
|
| 54 |
ids_list = justice_ids
|
| 55 |
elif celex_type == Versions.POLLUTION.value:
|
|
@@ -109,7 +110,7 @@ with block:
|
|
| 109 |
state = gr.State(value=None)
|
| 110 |
with gr.Row():
|
| 111 |
with gr.Column(scale=3):
|
| 112 |
-
drop_down = gr.Dropdown(label='Choose a version', choices=[attribute.value for attribute in Versions], value=Versions.BASIC)
|
| 113 |
chatbot = gr.Chatbot()
|
| 114 |
with gr.Row():
|
| 115 |
message = gr.Textbox(scale=10,label='',placeholder='Write a message...', container=False)
|
|
@@ -140,10 +141,12 @@ with block:
|
|
| 140 |
Contact us: <a href="mailto:chat-eur-lex@igsg.cnr.it">chat-eur-lex@igsg.cnr.it</a>.</p>
|
| 141 |
</div>""")
|
| 142 |
|
| 143 |
-
drop_down.change(reinit, inputs=[drop_down, bot], outputs=[message, chatbot, state, *accordions, *list_texts, col])
|
| 144 |
clear.click(clean_page, inputs=[bot], outputs=[message, chatbot, state, *accordions, *list_texts, col, bot])
|
| 145 |
-
message.submit(get_answer, inputs=[message, chatbot, state, drop_down, bot], outputs=[message, chatbot, col, *accordions, *list_texts, state, bot])
|
| 146 |
-
|
|
|
|
|
|
|
| 147 |
for i, b in enumerate(delete_buttons):
|
| 148 |
b.click(remove_doc, inputs=[states[i],bot], outputs=[*accordions, *list_texts, bot])
|
| 149 |
|
|
|
|
| 48 |
return [*new_accordions, *new_texts, bot]
|
| 49 |
|
| 50 |
|
| 51 |
+
def get_answer(message, history, session_id, bot):
|
| 52 |
s = session_id
|
| 53 |
+
celex_type = Versions.BASIC.value
|
| 54 |
if celex_type == Versions.JUSTICE.value:
|
| 55 |
ids_list = justice_ids
|
| 56 |
elif celex_type == Versions.POLLUTION.value:
|
|
|
|
| 110 |
state = gr.State(value=None)
|
| 111 |
with gr.Row():
|
| 112 |
with gr.Column(scale=3):
|
| 113 |
+
# drop_down = gr.Dropdown(label='Choose a version', choices=[attribute.value for attribute in Versions], value=Versions.BASIC)
|
| 114 |
chatbot = gr.Chatbot()
|
| 115 |
with gr.Row():
|
| 116 |
message = gr.Textbox(scale=10,label='',placeholder='Write a message...', container=False)
|
|
|
|
| 141 |
Contact us: <a href="mailto:chat-eur-lex@igsg.cnr.it">chat-eur-lex@igsg.cnr.it</a>.</p>
|
| 142 |
</div>""")
|
| 143 |
|
| 144 |
+
# drop_down.change(reinit, inputs=[drop_down, bot], outputs=[message, chatbot, state, *accordions, *list_texts, col])
|
| 145 |
clear.click(clean_page, inputs=[bot], outputs=[message, chatbot, state, *accordions, *list_texts, col, bot])
|
| 146 |
+
# message.submit(get_answer, inputs=[message, chatbot, state, drop_down, bot], outputs=[message, chatbot, col, *accordions, *list_texts, state, bot])
|
| 147 |
+
message.submit(get_answer, inputs=[message, chatbot, state, bot], outputs=[message, chatbot, col, *accordions, *list_texts, state, bot])
|
| 148 |
+
# submit.click(get_answer, inputs=[message, chatbot, state, drop_down, bot], outputs=[message, chatbot, col, *accordions, *list_texts, state, bot])
|
| 149 |
+
submit.click(get_answer, inputs=[message, chatbot, state, bot], outputs=[message, chatbot, col, *accordions, *list_texts, state, bot])
|
| 150 |
for i, b in enumerate(delete_buttons):
|
| 151 |
b.click(remove_doc, inputs=[states[i],bot], outputs=[*accordions, *list_texts, bot])
|
| 152 |
|