Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,6 +25,9 @@ def chatbot(talk_to_chatsherman, history=[]):
|
|
| 25 |
history.append((talk_to_chatsherman, output))
|
| 26 |
return history, history
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
title = "ChatSherman"
|
| 29 |
description = "This is an AI chatbot powered by ShermanAI."
|
| 30 |
examples = [
|
|
@@ -32,7 +35,7 @@ examples = [
|
|
| 32 |
["Can you explain the concept of electrical conductivity?", []],
|
| 33 |
["How do you calculate the force required to move an object?", []]
|
| 34 |
]
|
| 35 |
-
inputs = [gr.inputs.Textbox(label="Enter your question: "), "state"]
|
| 36 |
outputs = ["chatbot", "state"]
|
| 37 |
interface = gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title=title, description=description, examples=examples)
|
| 38 |
interface.launch(debug=True)
|
|
|
|
| 25 |
history.append((talk_to_chatsherman, output))
|
| 26 |
return history, history
|
| 27 |
|
| 28 |
+
def clear_textbox():
|
| 29 |
+
document.getElementById("input-textbox").value = "";
|
| 30 |
+
|
| 31 |
title = "ChatSherman"
|
| 32 |
description = "This is an AI chatbot powered by ShermanAI."
|
| 33 |
examples = [
|
|
|
|
| 35 |
["Can you explain the concept of electrical conductivity?", []],
|
| 36 |
["How do you calculate the force required to move an object?", []]
|
| 37 |
]
|
| 38 |
+
inputs = [gr.inputs.Textbox(label="Enter your question: ", onchange="clear_textbox()"), "state"]
|
| 39 |
outputs = ["chatbot", "state"]
|
| 40 |
interface = gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title=title, description=description, examples=examples)
|
| 41 |
interface.launch(debug=True)
|