Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Ste hyperbolic as fallback
Browse files- app.py +4 -5
- e2bqwen.py +5 -3
app.py
CHANGED
@@ -82,7 +82,7 @@ custom_css = """
|
|
82 |
.status-text {
|
83 |
font-size: 16px;
|
84 |
font-weight: bold;
|
85 |
-
padding:
|
86 |
text-shadow: none;
|
87 |
}
|
88 |
|
@@ -139,7 +139,7 @@ footer_html="""
|
|
139 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
140 |
<div class="logo-container">
|
141 |
<a class="logo-item" href="https://github.com/huggingface/smolagents"><i class="fa fa-github"></i>smolagents</a>
|
142 |
-
<a class="logo-item" href="https://huggingface.co/Qwen/Qwen2-VL-72B-Instruct"><i class="fa fa-github"></i>Qwen2-VL-72B
|
143 |
<a class="logo-item" href="https://github.com/e2b-dev/desktop"><i class="fa fa-github"></i>E2B Desktop</a>
|
144 |
</div>
|
145 |
"""
|
@@ -533,7 +533,7 @@ class EnrichedGradioUI(GradioUI):
|
|
533 |
theme = gr.themes.Default(font=["Oxanium", "sans-serif"], primary_hue="amber", secondary_hue="blue")
|
534 |
|
535 |
# Create a Gradio app with Blocks
|
536 |
-
with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=
|
537 |
#Storing session hash in a state variable
|
538 |
session_hash_state = gr.State(None)
|
539 |
|
@@ -602,7 +602,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as de
|
|
602 |
|
603 |
.status-bar {
|
604 |
position: absolute;
|
605 |
-
bottom:
|
606 |
left: 355px;
|
607 |
}
|
608 |
.status-text {
|
@@ -643,7 +643,6 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as de
|
|
643 |
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/mascot_smol.png",
|
644 |
),
|
645 |
resizable=True,
|
646 |
-
scale=1,
|
647 |
)
|
648 |
|
649 |
agent_ui = EnrichedGradioUI(CodeAgent(tools=[], model=None, name="ok", description="ok"))
|
|
|
82 |
.status-text {
|
83 |
font-size: 16px;
|
84 |
font-weight: bold;
|
85 |
+
padding-left: 8px;
|
86 |
text-shadow: none;
|
87 |
}
|
88 |
|
|
|
139 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
140 |
<div class="logo-container">
|
141 |
<a class="logo-item" href="https://github.com/huggingface/smolagents"><i class="fa fa-github"></i>smolagents</a>
|
142 |
+
<a class="logo-item" href="https://huggingface.co/Qwen/Qwen2-VL-72B-Instruct"><i class="fa fa-github"></i>Qwen2-VL-72B</a>
|
143 |
<a class="logo-item" href="https://github.com/e2b-dev/desktop"><i class="fa fa-github"></i>E2B Desktop</a>
|
144 |
</div>
|
145 |
"""
|
|
|
533 |
theme = gr.themes.Default(font=["Oxanium", "sans-serif"], primary_hue="amber", secondary_hue="blue")
|
534 |
|
535 |
# Create a Gradio app with Blocks
|
536 |
+
with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=False) as demo:
|
537 |
#Storing session hash in a state variable
|
538 |
session_hash_state = gr.State(None)
|
539 |
|
|
|
602 |
|
603 |
.status-bar {
|
604 |
position: absolute;
|
605 |
+
bottom: 88px;
|
606 |
left: 355px;
|
607 |
}
|
608 |
.status-text {
|
|
|
643 |
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/mascot_smol.png",
|
644 |
),
|
645 |
resizable=True,
|
|
|
646 |
)
|
647 |
|
648 |
agent_ui = EnrichedGradioUI(CodeAgent(tools=[], model=None, name="ok", description="ok"))
|
e2bqwen.py
CHANGED
@@ -376,7 +376,7 @@ class QwenVLAPIModel(Model):
|
|
376 |
)
|
377 |
self.fallback_model = HfApiModel(
|
378 |
model_id,
|
379 |
-
provider="
|
380 |
token=hf_token,
|
381 |
)
|
382 |
|
@@ -388,13 +388,15 @@ class QwenVLAPIModel(Model):
|
|
388 |
) -> ChatMessage:
|
389 |
|
390 |
try:
|
391 |
-
|
|
|
392 |
except Exception as e:
|
393 |
print(f"Base model failed with error: {e}. Calling fallback model.")
|
394 |
|
395 |
# Continue to fallback
|
396 |
try:
|
397 |
-
|
|
|
398 |
except Exception as e:
|
399 |
raise Exception(f"Both endpoints failed. Last error: {e}")
|
400 |
|
|
|
376 |
)
|
377 |
self.fallback_model = HfApiModel(
|
378 |
model_id,
|
379 |
+
provider="hyperbolic",
|
380 |
token=hf_token,
|
381 |
)
|
382 |
|
|
|
388 |
) -> ChatMessage:
|
389 |
|
390 |
try:
|
391 |
+
message = self.base_model(messages, stop_sequences, **kwargs)
|
392 |
+
return message
|
393 |
except Exception as e:
|
394 |
print(f"Base model failed with error: {e}. Calling fallback model.")
|
395 |
|
396 |
# Continue to fallback
|
397 |
try:
|
398 |
+
message = self.fallback_model(messages, stop_sequences, **kwargs)
|
399 |
+
return message
|
400 |
except Exception as e:
|
401 |
raise Exception(f"Both endpoints failed. Last error: {e}")
|
402 |
|