add hyperbolic deepseek
Browse files- app.py +1 -1
- app_hyperbolic.py +19 -21
- requirements.txt +1 -1
- utils_hyperbolic.py +44 -0
app.py
CHANGED
@@ -36,13 +36,13 @@ PROVIDERS = {
|
|
36 |
"Gemini": demo_gemini,
|
37 |
"OpenAI Voice": demo_openai_voice,
|
38 |
"Gemini Voice": demo_gemini_voice,
|
|
|
39 |
"CrewAI": demo_crew,
|
40 |
"LumaAI": demo_lumaai,
|
41 |
"ChatGPT": demo_openai,
|
42 |
"Grok": demo_grok,
|
43 |
"Cohere": demo_cohere,
|
44 |
"SambaNova": demo_sambanova,
|
45 |
-
"Hyperbolic": demo_hyperbolic,
|
46 |
"OminiControl": demo_omini,
|
47 |
"Fireworks": demo_fireworks,
|
48 |
"Together": demo_together,
|
|
|
36 |
"Gemini": demo_gemini,
|
37 |
"OpenAI Voice": demo_openai_voice,
|
38 |
"Gemini Voice": demo_gemini_voice,
|
39 |
+
"Hyperbolic": demo_hyperbolic,
|
40 |
"CrewAI": demo_crew,
|
41 |
"LumaAI": demo_lumaai,
|
42 |
"ChatGPT": demo_openai,
|
43 |
"Grok": demo_grok,
|
44 |
"Cohere": demo_cohere,
|
45 |
"SambaNova": demo_sambanova,
|
|
|
46 |
"OminiControl": demo_omini,
|
47 |
"Fireworks": demo_fireworks,
|
48 |
"Together": demo_together,
|
app_hyperbolic.py
CHANGED
@@ -1,27 +1,25 @@
|
|
1 |
-
import
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
7 |
demo = get_app(
|
8 |
-
models=
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
"meta-llama/Meta-Llama-3-70B-Instruct",
|
14 |
-
"NousResearch/Hermes-3-Llama-3.1-70B",
|
15 |
-
"Qwen/Qwen2.5-72B-Instruct",
|
16 |
-
"deepseek-ai/DeepSeek-V2.5",
|
17 |
-
"meta-llama/Meta-Llama-3.1-405B-Instruct",
|
18 |
-
"Qwen/QwQ-32B-Preview",
|
19 |
-
"meta-llama/Llama-3.3-70B-Instruct",
|
20 |
-
],
|
21 |
-
default_model="meta-llama/Llama-3.3-70B-Instruct",
|
22 |
-
src=hyperbolic_gradio.registry,
|
23 |
-
accept_token=not os.getenv("HYPERBOLIC_API_KEY"),
|
24 |
)
|
25 |
|
26 |
-
if __name__ == "__main__":
|
27 |
-
demo.launch()
|
|
|
1 |
+
import ai_gradio
|
2 |
+
from utils_hyperbolic import get_app
|
3 |
|
4 |
+
# Get the hyperbolic models but keep their full names for loading
|
5 |
+
HYPERBOLIC_MODELS_FULL = [
|
6 |
+
k for k in ai_gradio.registry.keys()
|
7 |
+
if k.startswith('hyperbolic:')
|
8 |
+
]
|
9 |
|
10 |
+
# Create display names without the prefix
|
11 |
+
HYPERBOLIC_MODELS_DISPLAY = [
|
12 |
+
k.replace('hyperbolic:', '')
|
13 |
+
for k in HYPERBOLIC_MODELS_FULL
|
14 |
+
]
|
15 |
|
16 |
+
|
17 |
+
# Create and launch the interface using get_app utility
|
18 |
demo = get_app(
|
19 |
+
models=HYPERBOLIC_MODELS_FULL, # Use the full names with prefix
|
20 |
+
default_model=HYPERBOLIC_MODELS_FULL[-1],
|
21 |
+
dropdown_label="Select Hyperbolic Model",
|
22 |
+
choices=HYPERBOLIC_MODELS_DISPLAY, # Display names without prefix
|
23 |
+
fill_height=True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
)
|
25 |
|
|
|
|
requirements.txt
CHANGED
@@ -513,7 +513,7 @@ xai-gradio==0.0.2
|
|
513 |
# via anychat (pyproject.toml)
|
514 |
yarl==1.18.3
|
515 |
# via aiohttp
|
516 |
-
ai-gradio[deepseek,crewai]==0.1.
|
517 |
crewai==0.86.0
|
518 |
instructor==1.3.3
|
519 |
crewai-tools>=0.17.0
|
|
|
513 |
# via anychat (pyproject.toml)
|
514 |
yarl==1.18.3
|
515 |
# via aiohttp
|
516 |
+
ai-gradio[deepseek,crewai,hyperbolic]==0.1.7
|
517 |
crewai==0.86.0
|
518 |
instructor==1.3.3
|
519 |
crewai-tools>=0.17.0
|
utils_hyperbolic.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def get_app(
|
4 |
+
models: list[str],
|
5 |
+
default_model: str,
|
6 |
+
dropdown_label: str = "Select Hyperbolic Model",
|
7 |
+
choices: list[str] = None,
|
8 |
+
**kwargs,
|
9 |
+
) -> gr.Blocks:
|
10 |
+
display_choices = choices if choices is not None else models
|
11 |
+
|
12 |
+
def update_model(new_model: str) -> list[gr.Column]:
|
13 |
+
if choices is not None:
|
14 |
+
idx = display_choices.index(new_model)
|
15 |
+
new_model = models[idx]
|
16 |
+
return [gr.Column(visible=model_name == new_model) for model_name in models]
|
17 |
+
|
18 |
+
with gr.Blocks(fill_height=True) as demo:
|
19 |
+
model = gr.Dropdown(
|
20 |
+
label=dropdown_label,
|
21 |
+
choices=display_choices,
|
22 |
+
value=choices[models.index(default_model)] if choices else default_model
|
23 |
+
)
|
24 |
+
|
25 |
+
columns = []
|
26 |
+
for model_name in models:
|
27 |
+
with gr.Column(visible=model_name == default_model) as column:
|
28 |
+
load_kwargs = {k: v for k, v in kwargs.items() if k not in ['src', 'choices']}
|
29 |
+
from ai_gradio.providers import registry
|
30 |
+
gr.load(name=model_name, src=registry, **load_kwargs)
|
31 |
+
columns.append(column)
|
32 |
+
|
33 |
+
model.change(
|
34 |
+
fn=update_model,
|
35 |
+
inputs=model,
|
36 |
+
outputs=columns,
|
37 |
+
api_name=False,
|
38 |
+
queue=False,
|
39 |
+
)
|
40 |
+
|
41 |
+
for fn in demo.fns.values():
|
42 |
+
fn.api_name = False
|
43 |
+
|
44 |
+
return demo
|