Spaces:
Sleeping
Sleeping
Update app.py
Browse filesadding get_text function
app.py
CHANGED
|
@@ -92,12 +92,16 @@ agent = CodeAgent(
|
|
| 92 |
theme = gr.themes.Soft()
|
| 93 |
ui_component = GradioUI(agent) # if this returns a component
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
with gr.Blocks(theme=theme) as demo:
|
| 96 |
gr.Markdown("# Chat with BookBrain 📚🤯")
|
| 97 |
|
| 98 |
input_box = gr.Textbox(label="Enter your question for BookBrain")
|
| 99 |
output_box = gr.Textbox(label="Response")
|
| 100 |
submit_btn = gr.Button("Submit")
|
| 101 |
-
submit_btn.click(inputs=input_box, outputs=output_box)
|
| 102 |
|
| 103 |
demo.launch()
|
|
|
|
| 92 |
theme = gr.themes.Soft()
|
| 93 |
ui_component = GradioUI(agent) # if this returns a component
|
| 94 |
|
| 95 |
+
def get_text(question):
|
| 96 |
+
response = agent.run(question)
|
| 97 |
+
return response
|
| 98 |
+
|
| 99 |
with gr.Blocks(theme=theme) as demo:
|
| 100 |
gr.Markdown("# Chat with BookBrain 📚🤯")
|
| 101 |
|
| 102 |
input_box = gr.Textbox(label="Enter your question for BookBrain")
|
| 103 |
output_box = gr.Textbox(label="Response")
|
| 104 |
submit_btn = gr.Button("Submit")
|
| 105 |
+
submit_btn.click(fn=get_text, inputs=input_box, outputs=output_box)
|
| 106 |
|
| 107 |
demo.launch()
|