updated images and examples
Browse files- .gitattributes +1 -0
- app.py +35 -2
- examples/bird_example_4.jpg +3 -0
- examples/bird_example_5.jpg +0 -0
.gitattributes
CHANGED
|
@@ -37,3 +37,4 @@ examples/another_bird.jpg filter=lfs diff=lfs merge=lfs -text
|
|
| 37 |
examples/bird_example_1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
examples/bird_example_2.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
examples/bird_exmample_4.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 37 |
examples/bird_example_1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
examples/bird_example_2.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
examples/bird_exmample_4.jpg filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
examples/bird_example_4.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -24,7 +24,7 @@ load_dotenv()
|
|
| 24 |
PHOTO_EXAMPLES = [
|
| 25 |
{"text": "What bird is this?", "files": ["examples/bird_example_1.jpg"]},
|
| 26 |
{"text": "Can you identify this bird?", "files": ["examples/bird_example_2.jpg"]},
|
| 27 |
-
{"text": "Identify this bird and show me similar species", "files": ["examples/
|
| 28 |
]
|
| 29 |
|
| 30 |
# Text-only examples for Specialized Subagents mode
|
|
@@ -38,7 +38,7 @@ MULTI_AGENT_TEXT_EXAMPLES = [
|
|
| 38 |
AUDIO_FINDER_TEXT_EXAMPLES = [
|
| 39 |
"Find me audio for any bird",
|
| 40 |
"Get audio recordings for Snow Goose",
|
| 41 |
-
"Find
|
| 42 |
"Show me audio recordings of Common Goldeneye"
|
| 43 |
]
|
| 44 |
|
|
@@ -967,6 +967,24 @@ async def check_modal_server_health():
|
|
| 967 |
else:
|
| 968 |
return f"❌ Offline"
|
| 969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 970 |
# Wrapper to convert to Gradio 6 message format
|
| 971 |
async def chat_wrapper(message, history, provider, hf_key, openai_key, anthropic_key, agent_mode, tool_log_state, request: gr.Request, progress=gr.Progress()):
|
| 972 |
"""
|
|
@@ -983,6 +1001,13 @@ async def chat_wrapper(message, history, provider, hf_key, openai_key, anthropic
|
|
| 983 |
else:
|
| 984 |
user_message_text = message
|
| 985 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 986 |
# Add user message to history
|
| 987 |
history = history + [{"role": "user", "content": user_message_text}]
|
| 988 |
|
|
@@ -1748,6 +1773,10 @@ with gr.Blocks() as demo:
|
|
| 1748 |
)
|
| 1749 |
|
| 1750 |
submit_event = msg.submit(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1751 |
fn=chat_wrapper,
|
| 1752 |
inputs=[msg, chatbot, provider, hf_key, openai_key, anthropic_key, agent_mode, tool_log_state],
|
| 1753 |
outputs=[chatbot, tool_output]
|
|
@@ -1759,6 +1788,10 @@ with gr.Blocks() as demo:
|
|
| 1759 |
)
|
| 1760 |
|
| 1761 |
submit_click = submit.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1762 |
fn=chat_wrapper,
|
| 1763 |
inputs=[msg, chatbot, provider, hf_key, openai_key, anthropic_key, agent_mode, tool_log_state],
|
| 1764 |
outputs=[chatbot, tool_output]
|
|
|
|
| 24 |
PHOTO_EXAMPLES = [
|
| 25 |
{"text": "What bird is this?", "files": ["examples/bird_example_1.jpg"]},
|
| 26 |
{"text": "Can you identify this bird?", "files": ["examples/bird_example_2.jpg"]},
|
| 27 |
+
{"text": "Identify this bird and show me similar species", "files": ["examples/bird_example_5.jpg"]}
|
| 28 |
]
|
| 29 |
|
| 30 |
# Text-only examples for Specialized Subagents mode
|
|
|
|
| 38 |
AUDIO_FINDER_TEXT_EXAMPLES = [
|
| 39 |
"Find me audio for any bird",
|
| 40 |
"Get audio recordings for Snow Goose",
|
| 41 |
+
"Find me any two audio samples of bird calls",
|
| 42 |
"Show me audio recordings of Common Goldeneye"
|
| 43 |
]
|
| 44 |
|
|
|
|
| 967 |
else:
|
| 968 |
return f"❌ Offline"
|
| 969 |
|
| 970 |
+
def show_immediate_loading(message, history, tool_log_state):
|
| 971 |
+
"""
|
| 972 |
+
Show immediate loading indicator when user submits a message.
|
| 973 |
+
This provides instant feedback before async processing begins.
|
| 974 |
+
|
| 975 |
+
Returns: (updated_history, updated_tool_log)
|
| 976 |
+
"""
|
| 977 |
+
# Just add a loading indicator to the history
|
| 978 |
+
# The user message will be added by chat_wrapper to avoid duplication
|
| 979 |
+
updated_history = history + [
|
| 980 |
+
{"role": "assistant", "content": "⏳ _Starting..._"}
|
| 981 |
+
]
|
| 982 |
+
|
| 983 |
+
# Add initial message to tool log
|
| 984 |
+
updated_tool_log = "🔵 Initializing agent...\n"
|
| 985 |
+
|
| 986 |
+
return updated_history, updated_tool_log
|
| 987 |
+
|
| 988 |
# Wrapper to convert to Gradio 6 message format
|
| 989 |
async def chat_wrapper(message, history, provider, hf_key, openai_key, anthropic_key, agent_mode, tool_log_state, request: gr.Request, progress=gr.Progress()):
|
| 990 |
"""
|
|
|
|
| 1001 |
else:
|
| 1002 |
user_message_text = message
|
| 1003 |
|
| 1004 |
+
# Check if immediate loading added a loading indicator
|
| 1005 |
+
if (len(history) >= 1 and
|
| 1006 |
+
history[-1].get("role") == "assistant" and
|
| 1007 |
+
history[-1].get("content") == "⏳ _Starting..._"):
|
| 1008 |
+
# Remove loading indicator
|
| 1009 |
+
history = history[:-1]
|
| 1010 |
+
|
| 1011 |
# Add user message to history
|
| 1012 |
history = history + [{"role": "user", "content": user_message_text}]
|
| 1013 |
|
|
|
|
| 1773 |
)
|
| 1774 |
|
| 1775 |
submit_event = msg.submit(
|
| 1776 |
+
fn=show_immediate_loading,
|
| 1777 |
+
inputs=[msg, chatbot, tool_log_state],
|
| 1778 |
+
outputs=[chatbot, tool_output]
|
| 1779 |
+
).then(
|
| 1780 |
fn=chat_wrapper,
|
| 1781 |
inputs=[msg, chatbot, provider, hf_key, openai_key, anthropic_key, agent_mode, tool_log_state],
|
| 1782 |
outputs=[chatbot, tool_output]
|
|
|
|
| 1788 |
)
|
| 1789 |
|
| 1790 |
submit_click = submit.click(
|
| 1791 |
+
fn=show_immediate_loading,
|
| 1792 |
+
inputs=[msg, chatbot, tool_log_state],
|
| 1793 |
+
outputs=[chatbot, tool_output]
|
| 1794 |
+
).then(
|
| 1795 |
fn=chat_wrapper,
|
| 1796 |
inputs=[msg, chatbot, provider, hf_key, openai_key, anthropic_key, agent_mode, tool_log_state],
|
| 1797 |
outputs=[chatbot, tool_output]
|
examples/bird_example_4.jpg
ADDED
|
Git LFS Details
|
examples/bird_example_5.jpg
ADDED
|