Spaces:
Sleeping
Sleeping
Update app.py
Browse filesremoved gradio updates
app.py
CHANGED
|
@@ -5,7 +5,6 @@ import pytz
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
-
import gradio as gr
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
# Below is a tool that gets a list of books from an app I built on Replit
|
|
@@ -89,32 +88,4 @@ agent = CodeAgent(
|
|
| 89 |
prompt_templates=prompt_templates
|
| 90 |
)
|
| 91 |
|
| 92 |
-
|
| 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 |
-
def chat_fn(user_message, history):
|
| 100 |
-
# Initialize history if it's empty
|
| 101 |
-
history = history or []
|
| 102 |
-
# Call your agent to get a response
|
| 103 |
-
response = agent.run(user_message)
|
| 104 |
-
# Append the new exchange as a tuple (user_message, response)
|
| 105 |
-
history.append((user_message, response))
|
| 106 |
-
return history
|
| 107 |
-
|
| 108 |
-
with gr.Blocks(theme=theme) as demo:
|
| 109 |
-
gr.Markdown("# Chat with BookBrain 📚🤯")
|
| 110 |
-
|
| 111 |
-
#input_box = gr.Textbox(label="Enter your question for BookBrain")
|
| 112 |
-
#output_box = gr.Textbox(label="Response")
|
| 113 |
-
chatbot = gr.Chatbot(label="Chat")
|
| 114 |
-
user_input = gr.Textbox(label="Your question", placeholder="Ask your question here...", show_label=True)
|
| 115 |
-
submit_btn = gr.Button("Submit")
|
| 116 |
-
#submit_btn.click(fn=get_text, inputs=input_box, outputs=output_box)
|
| 117 |
-
user_input.submit(chat_fn, inputs=[user_input, chatbot], outputs=chatbot)
|
| 118 |
-
submit_btn.click(chat_fn, inputs=[user_input, chatbot], outputs=chatbot)
|
| 119 |
-
|
| 120 |
-
demo.launch()
|
|
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is a tool that gets a list of books from an app I built on Replit
|
|
|
|
| 88 |
prompt_templates=prompt_templates
|
| 89 |
)
|
| 90 |
|
| 91 |
+
GradioUI(agent).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|