Spaces:
Runtime error
Runtime error
tried different films
Browse files
app.py
CHANGED
|
@@ -267,7 +267,9 @@ def solve_problem_gradio(user_query, user_image, max_steps=10, max_time=60, api_
|
|
| 267 |
|
| 268 |
def main(args):
|
| 269 |
#################### Gradio Interface ####################
|
| 270 |
-
with gr.Blocks() as demo:
|
|
|
|
|
|
|
| 271 |
gr.Markdown("# π Chat with OctoTools: An Agentic Framework for Complex Reasoning") # Title
|
| 272 |
# gr.Markdown("[](https://octotools.github.io/)") # Title
|
| 273 |
gr.Markdown("""
|
|
@@ -294,6 +296,7 @@ def main(args):
|
|
| 294 |
# container=False
|
| 295 |
)
|
| 296 |
|
|
|
|
| 297 |
llm_model_engine = gr.Dropdown(
|
| 298 |
choices=["gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13",
|
| 299 |
"gpt-4o-mini", "gpt-4o-mini-2024-07-18"],
|
|
@@ -302,23 +305,26 @@ def main(args):
|
|
| 302 |
)
|
| 303 |
with gr.Row():
|
| 304 |
max_steps = gr.Slider(value=5, minimum=1, maximum=10, step=1, label="Max Steps")
|
|
|
|
|
|
|
| 305 |
max_time = gr.Slider(value=180, minimum=60, maximum=300, step=30, label="Max Time (seconds)")
|
| 306 |
|
| 307 |
with gr.Row():
|
| 308 |
# Container for tools section
|
| 309 |
with gr.Column():
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
enable_all_btn = gr.Button("Select All Tools")
|
| 313 |
-
disable_all_btn = gr.Button("Clear All Tools")
|
| 314 |
-
|
| 315 |
-
# Second row for checkbox group
|
| 316 |
enabled_tools = gr.CheckboxGroup(
|
| 317 |
choices=all_tools,
|
| 318 |
value=all_tools,
|
| 319 |
label="Selected Tools",
|
| 320 |
)
|
| 321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
# Add click handlers for the buttons
|
| 323 |
enable_all_btn.click(
|
| 324 |
lambda: all_tools,
|
|
@@ -334,23 +340,24 @@ def main(args):
|
|
| 334 |
with gr.Row():
|
| 335 |
# Middle column for the query
|
| 336 |
with gr.Column(scale=2):
|
| 337 |
-
user_image = gr.Image(type="pil", label="Upload
|
| 338 |
|
| 339 |
with gr.Row():
|
| 340 |
user_query = gr.Textbox( placeholder="Type your question here...", label="Question (Required)")
|
| 341 |
|
| 342 |
with gr.Row():
|
| 343 |
-
run_button = gr.Button("Submit and Run", variant="primary") # Run button with blue color
|
| 344 |
|
| 345 |
# Right column for the output
|
| 346 |
with gr.Column(scale=3):
|
| 347 |
-
chatbot_output = gr.Chatbot(type="messages", label="Step-
|
| 348 |
# chatbot_output.like(lambda x: print(f"User liked: {x}"))
|
| 349 |
|
| 350 |
# TODO: Add actions to the buttons
|
| 351 |
with gr.Row(elem_id="buttons") as button_row:
|
| 352 |
upvote_btn = gr.Button(value="π Upvote", interactive=True, variant="primary")
|
| 353 |
downvote_btn = gr.Button(value="π Downvote", interactive=True, variant="primary")
|
|
|
|
| 354 |
clear_btn = gr.Button(value="ποΈ Clear history", interactive=True)
|
| 355 |
|
| 356 |
with gr.Row():
|
|
@@ -374,9 +381,10 @@ def main(args):
|
|
| 374 |
[ "examples/rotting_kiwi.png", "You are given a 3 x 3 grid in which each cell can contain either no kiwi, one fresh kiwi, or one rotten kiwi. Every minute, any fresh kiwi that is 4-directionally adjacent to a rotten kiwi also becomes rotten. What is the minimum number of minutes that must elapse until no cell has a fresh kiwi?", ["Image_Captioner_Tool"]],
|
| 375 |
|
| 376 |
["examples/lung.jpg", "What is the organ on the left side of this image?", ["Image_Captioner_Tool"]],
|
|
|
|
| 377 |
],
|
| 378 |
inputs=[user_image, user_query, enabled_tools],
|
| 379 |
-
label="Try these examples"
|
| 380 |
)
|
| 381 |
|
| 382 |
# Link button click to function
|
|
|
|
| 267 |
|
| 268 |
def main(args):
|
| 269 |
#################### Gradio Interface ####################
|
| 270 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 271 |
+
# Theming https://www.gradio.app/guides/theming-guide
|
| 272 |
+
|
| 273 |
gr.Markdown("# π Chat with OctoTools: An Agentic Framework for Complex Reasoning") # Title
|
| 274 |
# gr.Markdown("[](https://octotools.github.io/)") # Title
|
| 275 |
gr.Markdown("""
|
|
|
|
| 296 |
# container=False
|
| 297 |
)
|
| 298 |
|
| 299 |
+
with gr.Row():
|
| 300 |
llm_model_engine = gr.Dropdown(
|
| 301 |
choices=["gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13",
|
| 302 |
"gpt-4o-mini", "gpt-4o-mini-2024-07-18"],
|
|
|
|
| 305 |
)
|
| 306 |
with gr.Row():
|
| 307 |
max_steps = gr.Slider(value=5, minimum=1, maximum=10, step=1, label="Max Steps")
|
| 308 |
+
|
| 309 |
+
with gr.Row():
|
| 310 |
max_time = gr.Slider(value=180, minimum=60, maximum=300, step=30, label="Max Time (seconds)")
|
| 311 |
|
| 312 |
with gr.Row():
|
| 313 |
# Container for tools section
|
| 314 |
with gr.Column():
|
| 315 |
+
|
| 316 |
+
# First row for checkbox group
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
enabled_tools = gr.CheckboxGroup(
|
| 318 |
choices=all_tools,
|
| 319 |
value=all_tools,
|
| 320 |
label="Selected Tools",
|
| 321 |
)
|
| 322 |
|
| 323 |
+
# Second row for buttons
|
| 324 |
+
with gr.Row():
|
| 325 |
+
enable_all_btn = gr.Button("Select All Tools")
|
| 326 |
+
disable_all_btn = gr.Button("Clear All Tools")
|
| 327 |
+
|
| 328 |
# Add click handlers for the buttons
|
| 329 |
enable_all_btn.click(
|
| 330 |
lambda: all_tools,
|
|
|
|
| 340 |
with gr.Row():
|
| 341 |
# Middle column for the query
|
| 342 |
with gr.Column(scale=2):
|
| 343 |
+
user_image = gr.Image(type="pil", label="Upload an Image (Optional)", height=500) # Accepts multiple formats
|
| 344 |
|
| 345 |
with gr.Row():
|
| 346 |
user_query = gr.Textbox( placeholder="Type your question here...", label="Question (Required)")
|
| 347 |
|
| 348 |
with gr.Row():
|
| 349 |
+
run_button = gr.Button("π Submit and Run", variant="primary") # Run button with blue color
|
| 350 |
|
| 351 |
# Right column for the output
|
| 352 |
with gr.Column(scale=3):
|
| 353 |
+
chatbot_output = gr.Chatbot(type="messages", label="Step-wise Problem-Solving Output (Deep Thinking)", height=500)
|
| 354 |
# chatbot_output.like(lambda x: print(f"User liked: {x}"))
|
| 355 |
|
| 356 |
# TODO: Add actions to the buttons
|
| 357 |
with gr.Row(elem_id="buttons") as button_row:
|
| 358 |
upvote_btn = gr.Button(value="π Upvote", interactive=True, variant="primary")
|
| 359 |
downvote_btn = gr.Button(value="π Downvote", interactive=True, variant="primary")
|
| 360 |
+
stop_btn = gr.Button(value="βοΈ Stop", interactive=True, variant="primary")
|
| 361 |
clear_btn = gr.Button(value="ποΈ Clear history", interactive=True)
|
| 362 |
|
| 363 |
with gr.Row():
|
|
|
|
| 381 |
[ "examples/rotting_kiwi.png", "You are given a 3 x 3 grid in which each cell can contain either no kiwi, one fresh kiwi, or one rotten kiwi. Every minute, any fresh kiwi that is 4-directionally adjacent to a rotten kiwi also becomes rotten. What is the minimum number of minutes that must elapse until no cell has a fresh kiwi?", ["Image_Captioner_Tool"]],
|
| 382 |
|
| 383 |
["examples/lung.jpg", "What is the organ on the left side of this image?", ["Image_Captioner_Tool"]],
|
| 384 |
+
|
| 385 |
],
|
| 386 |
inputs=[user_image, user_query, enabled_tools],
|
| 387 |
+
label="Try these examples with suggested tools."
|
| 388 |
)
|
| 389 |
|
| 390 |
# Link button click to function
|