Spaces:
Sleeping
Sleeping
Commit
·
b4250e6
1
Parent(s):
25f0c44
Improvised UI
Browse files
app.py
CHANGED
|
@@ -83,18 +83,15 @@ def chatbot(input_text, chat_history):
|
|
| 83 |
|
| 84 |
chat_history.append([input_text, response])
|
| 85 |
|
| 86 |
-
return chat_history
|
| 87 |
|
| 88 |
except OutputParserException as e:
|
| 89 |
error_message = exceptionMsg
|
| 90 |
chat_history.append([error_message, input_text])
|
| 91 |
print("Error:", str(e))
|
| 92 |
|
| 93 |
-
return chat_history
|
| 94 |
|
| 95 |
-
def clear_input():
|
| 96 |
-
return gr.update(value="")
|
| 97 |
-
|
| 98 |
def clear_chat():
|
| 99 |
return [],""
|
| 100 |
|
|
@@ -111,10 +108,8 @@ def gradio_interface():
|
|
| 111 |
user_input = gr.Textbox(placeholder="Ask your legal questions here, such as IPC sections, property laws, constitution articles.")
|
| 112 |
submit_button = gr.Button("Submit", elem_classes="gr-button", variant="primary")
|
| 113 |
clear_chat_button = gr.Button("Clear Chat", variant="secondary")
|
| 114 |
-
submit_button.click(fn=chatbot, inputs=[user_input, chatbot_ui], outputs=chatbot_ui)
|
| 115 |
-
|
| 116 |
-
user_input.submit(fn=chatbot, inputs=[user_input, chatbot_ui], outputs=chatbot_ui)
|
| 117 |
-
user_input.submit(fn=clear_input, inputs=None, outputs=user_input)
|
| 118 |
clear_chat_button.click(fn=clear_chat, inputs=None, outputs=[chatbot_ui, user_input])
|
| 119 |
|
| 120 |
|
|
|
|
| 83 |
|
| 84 |
chat_history.append([input_text, response])
|
| 85 |
|
| 86 |
+
return chat_history, ""
|
| 87 |
|
| 88 |
except OutputParserException as e:
|
| 89 |
error_message = exceptionMsg
|
| 90 |
chat_history.append([error_message, input_text])
|
| 91 |
print("Error:", str(e))
|
| 92 |
|
| 93 |
+
return chat_history, ""
|
| 94 |
|
|
|
|
|
|
|
|
|
|
| 95 |
def clear_chat():
|
| 96 |
return [],""
|
| 97 |
|
|
|
|
| 108 |
user_input = gr.Textbox(placeholder="Ask your legal questions here, such as IPC sections, property laws, constitution articles.")
|
| 109 |
submit_button = gr.Button("Submit", elem_classes="gr-button", variant="primary")
|
| 110 |
clear_chat_button = gr.Button("Clear Chat", variant="secondary")
|
| 111 |
+
submit_button.click(fn=chatbot, inputs=[user_input, chatbot_ui], outputs=[chatbot_ui, user_input])
|
| 112 |
+
user_input.submit(fn=chatbot, inputs=[user_input, chatbot_ui], outputs=[chatbot_ui, user_input])
|
|
|
|
|
|
|
| 113 |
clear_chat_button.click(fn=clear_chat, inputs=None, outputs=[chatbot_ui, user_input])
|
| 114 |
|
| 115 |
|