Spaces:
Sleeping
Sleeping
Update Gradio_UI.py
Browse files- Gradio_UI.py +5 -7
Gradio_UI.py
CHANGED
|
@@ -75,7 +75,6 @@ def continue_conversation(user_input):
|
|
| 75 |
next_question = conversation_state["questions"][conversation_state["step"]][1]
|
| 76 |
return f"🧠 {next_question}", None
|
| 77 |
else:
|
| 78 |
-
# Optionally: use conversation_state["tool"].run_tool() here if needed
|
| 79 |
pdf_path = export_pdf(conversation_state["title"], conversation_state["answers"], lang=conversation_state["lang"])
|
| 80 |
return "✅ Done! Your document is ready to download.", pdf_path
|
| 81 |
|
|
@@ -85,16 +84,15 @@ with gr.Blocks(title="Regulatory Compliance Generator") as demo:
|
|
| 85 |
|
| 86 |
with gr.Row():
|
| 87 |
reg_dropdown = gr.Dropdown(choices=list(DOCUMENT_TO_MODULE.keys()), label="Select Regulation")
|
| 88 |
-
doc_dropdown = gr.Dropdown(label="Select Document Type")
|
| 89 |
|
| 90 |
def update_doc_dropdown(selected_reg):
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
reg_dropdown.change(update_doc_dropdown, inputs=reg_dropdown, outputs=doc_dropdown)
|
| 96 |
|
| 97 |
-
|
| 98 |
start_btn = gr.Button("🚀 Start")
|
| 99 |
chatbox = gr.Chatbot(label="🧑⚖️ Legalbot", value=[])
|
| 100 |
user_input = gr.Textbox(label="Your answer", placeholder="Type your answer and press Enter")
|
|
@@ -102,6 +100,6 @@ with gr.Blocks(title="Regulatory Compliance Generator") as demo:
|
|
| 102 |
|
| 103 |
start_btn.click(start_conversation, inputs=[reg_dropdown, doc_dropdown], outputs=chatbox)
|
| 104 |
user_input.submit(continue_conversation, inputs=user_input, outputs=[chatbox, pdf_output])
|
| 105 |
-
user_input.submit(lambda: "", None, user_input)
|
| 106 |
|
| 107 |
demo.launch()
|
|
|
|
| 75 |
next_question = conversation_state["questions"][conversation_state["step"]][1]
|
| 76 |
return f"🧠 {next_question}", None
|
| 77 |
else:
|
|
|
|
| 78 |
pdf_path = export_pdf(conversation_state["title"], conversation_state["answers"], lang=conversation_state["lang"])
|
| 79 |
return "✅ Done! Your document is ready to download.", pdf_path
|
| 80 |
|
|
|
|
| 84 |
|
| 85 |
with gr.Row():
|
| 86 |
reg_dropdown = gr.Dropdown(choices=list(DOCUMENT_TO_MODULE.keys()), label="Select Regulation")
|
| 87 |
+
doc_dropdown = gr.Dropdown(label="Select Document Type", choices=[])
|
| 88 |
|
| 89 |
def update_doc_dropdown(selected_reg):
|
| 90 |
+
if selected_reg in DOCUMENT_TO_MODULE:
|
| 91 |
+
return gr.update(choices=list(DOCUMENT_TO_MODULE[selected_reg].keys()), value=None)
|
| 92 |
+
return gr.update(choices=[], value=None)
|
| 93 |
|
| 94 |
reg_dropdown.change(update_doc_dropdown, inputs=reg_dropdown, outputs=doc_dropdown)
|
| 95 |
|
|
|
|
| 96 |
start_btn = gr.Button("🚀 Start")
|
| 97 |
chatbox = gr.Chatbot(label="🧑⚖️ Legalbot", value=[])
|
| 98 |
user_input = gr.Textbox(label="Your answer", placeholder="Type your answer and press Enter")
|
|
|
|
| 100 |
|
| 101 |
start_btn.click(start_conversation, inputs=[reg_dropdown, doc_dropdown], outputs=chatbox)
|
| 102 |
user_input.submit(continue_conversation, inputs=user_input, outputs=[chatbox, pdf_output])
|
| 103 |
+
user_input.submit(lambda: "", None, user_input)
|
| 104 |
|
| 105 |
demo.launch()
|