Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
coding
#47
by
JTSKY100
- opened
- app.py +12 -83
- app_gemini_coder.py +1 -1
- app_huggingface.py +62 -16
- app_hyperbolic.py +1 -1
- app_hyperbolic_coder.py +1 -1
- app_nvidia_coder.py +0 -23
- app_openai_coder.py +1 -1
- app_openrouter.py +0 -22
- app_qwen.py +22 -14
- app_qwen_coder.py +0 -20
- app_sambanova.py +24 -15
- app_sambanova_coder.py +0 -20
- pyproject.toml +1 -1
- requirements.txt +2 -3
app.py
CHANGED
@@ -10,6 +10,7 @@ from app_replicate import demo as demo_replicate
|
|
10 |
from app_sambanova import demo as demo_sambanova
|
11 |
from app_together import demo as demo_together
|
12 |
from app_xai import demo as demo_grok
|
|
|
13 |
from app_crew import demo as demo_crew
|
14 |
from app_hyperbolic import demo as demo_hyperbolic
|
15 |
from app_gemini_coder import demo as demo_gemini_coder
|
@@ -25,70 +26,24 @@ from app_minimax import demo as demo_minimax
|
|
25 |
from app_minimax_coder import demo as demo_minimax_coder
|
26 |
from app_nvidia import demo as demo_nvidia
|
27 |
from app_deepseek import demo as demo_deepseek
|
28 |
-
from app_qwen import demo as demo_qwen
|
29 |
-
from app_qwen_coder import demo as demo_qwen_coder
|
30 |
-
from app_nvidia_coder import demo as demo_nvidia_coder
|
31 |
-
from app_openai import demo as demo_openai
|
32 |
-
from app_sambanova_coder import demo as demo_sambanova_coder
|
33 |
-
from app_openrouter import demo as demo_openrouter
|
34 |
-
from app_huggingface import demo as demo_huggingface
|
35 |
from utils import get_app
|
36 |
-
import gradio as gr
|
37 |
-
|
38 |
-
# Create mapping of providers to their code snippets
|
39 |
-
PROVIDER_SNIPPETS = {
|
40 |
-
"OpenAI Coder": """import gradio as gr
|
41 |
-
import ai_gradio
|
42 |
-
gr.load(
|
43 |
-
name='openai:o3-mini-2025-01-31',
|
44 |
-
src=ai_gradio.registry,
|
45 |
-
coder=True
|
46 |
-
).launch()""",
|
47 |
-
"Gemini Coder": """import gradio as gr
|
48 |
-
import ai_gradio
|
49 |
-
gr.load(
|
50 |
-
name='gemini:gemini-1.5-flash',
|
51 |
-
src=ai_gradio.registry,
|
52 |
-
coder=True
|
53 |
-
).launch()""",
|
54 |
-
"Hyperbolic": """import gradio as gr
|
55 |
-
import ai_gradio
|
56 |
-
gr.load(
|
57 |
-
name='hyperbolic:deepseek-ai/DeepSeek-R1',
|
58 |
-
src=ai_gradio.registry,
|
59 |
-
).launch()""",
|
60 |
-
"OpenRouter Coder": """import gradio as gr
|
61 |
-
import ai_gradio
|
62 |
-
gr.load(
|
63 |
-
name='openrouter:openai/o3-mini-2025-01-31',
|
64 |
-
src=ai_gradio.registry,
|
65 |
-
coder=True
|
66 |
-
).launch()""",
|
67 |
-
# Add similar snippets for other providers
|
68 |
-
}
|
69 |
|
70 |
# Create mapping of providers to their demos
|
71 |
PROVIDERS = {
|
72 |
-
"OpenRouter Coder": demo_openrouter,
|
73 |
-
"Huggingface": demo_huggingface,
|
74 |
-
"OpenAI Coder": demo_openai_coder,
|
75 |
-
"Sambanova Coder": demo_sambanova_coder,
|
76 |
"Gemini Coder": demo_gemini_coder,
|
77 |
-
"OpenAI": demo_openai,
|
78 |
-
"NVIDIA Coder": demo_nvidia_coder,
|
79 |
-
"Hyperbolic Coder": demo_hyperbolic_coder,
|
80 |
-
"Hyperbolic": demo_hyperbolic,
|
81 |
"Groq Coder": demo_groq_coder,
|
82 |
-
"Qwen Coder": demo_qwen_coder,
|
83 |
-
"Qwen": demo_qwen,
|
84 |
"DeepSeek Coder": demo_deepseek,
|
85 |
"Minimax Coder": demo_minimax_coder,
|
86 |
"NVIDIA": demo_nvidia,
|
87 |
"Minimax": demo_minimax,
|
88 |
"Mistral": demo_mistral,
|
89 |
"Langchain Agent": demo_langchain,
|
|
|
90 |
"Gemini": demo_gemini,
|
|
|
91 |
"SmolAgents": demo_smolagents,
|
|
|
|
|
92 |
"CrewAI": demo_crew,
|
93 |
"LumaAI": demo_lumaai,
|
94 |
"Grok": demo_grok,
|
@@ -105,38 +60,12 @@ PROVIDERS = {
|
|
105 |
"Perplexity": demo_perplexity,
|
106 |
}
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
choices=list(PROVIDERS.keys()),
|
115 |
-
value="OpenRouter Coder",
|
116 |
-
label="Select code snippet"
|
117 |
-
)
|
118 |
-
code_display = gr.Code(
|
119 |
-
label="Provider Code Snippet",
|
120 |
-
language="python",
|
121 |
-
value=PROVIDER_SNIPPETS["OpenRouter Coder"]
|
122 |
-
)
|
123 |
-
|
124 |
-
def update_code(provider):
|
125 |
-
return PROVIDER_SNIPPETS.get(provider, "Code snippet not available")
|
126 |
-
|
127 |
-
|
128 |
-
provider_dropdown.change(
|
129 |
-
fn=update_code,
|
130 |
-
inputs=[provider_dropdown],
|
131 |
-
outputs=[code_display]
|
132 |
-
)
|
133 |
-
|
134 |
-
selected_demo = get_app(
|
135 |
-
models=list(PROVIDERS.keys()),
|
136 |
-
default_model="OpenRouter Coder",
|
137 |
-
src=PROVIDERS,
|
138 |
-
dropdown_label="Select Provider",
|
139 |
-
)
|
140 |
|
141 |
if __name__ == "__main__":
|
142 |
-
demo.queue(api_open=False).launch(show_api=False)
|
|
|
10 |
from app_sambanova import demo as demo_sambanova
|
11 |
from app_together import demo as demo_together
|
12 |
from app_xai import demo as demo_grok
|
13 |
+
from app_qwen import demo as demo_qwen
|
14 |
from app_crew import demo as demo_crew
|
15 |
from app_hyperbolic import demo as demo_hyperbolic
|
16 |
from app_gemini_coder import demo as demo_gemini_coder
|
|
|
26 |
from app_minimax_coder import demo as demo_minimax_coder
|
27 |
from app_nvidia import demo as demo_nvidia
|
28 |
from app_deepseek import demo as demo_deepseek
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
from utils import get_app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
# Create mapping of providers to their demos
|
32 |
PROVIDERS = {
|
|
|
|
|
|
|
|
|
33 |
"Gemini Coder": demo_gemini_coder,
|
|
|
|
|
|
|
|
|
34 |
"Groq Coder": demo_groq_coder,
|
|
|
|
|
35 |
"DeepSeek Coder": demo_deepseek,
|
36 |
"Minimax Coder": demo_minimax_coder,
|
37 |
"NVIDIA": demo_nvidia,
|
38 |
"Minimax": demo_minimax,
|
39 |
"Mistral": demo_mistral,
|
40 |
"Langchain Agent": demo_langchain,
|
41 |
+
"OpenAI Coder": demo_openai_coder,
|
42 |
"Gemini": demo_gemini,
|
43 |
+
"Hyperbolic Coder": demo_hyperbolic_coder,
|
44 |
"SmolAgents": demo_smolagents,
|
45 |
+
"Qwen": demo_qwen,
|
46 |
+
"Hyperbolic": demo_hyperbolic,
|
47 |
"CrewAI": demo_crew,
|
48 |
"LumaAI": demo_lumaai,
|
49 |
"Grok": demo_grok,
|
|
|
60 |
"Perplexity": demo_perplexity,
|
61 |
}
|
62 |
|
63 |
+
demo = get_app(
|
64 |
+
models=list(PROVIDERS.keys()),
|
65 |
+
default_model="Gemini Coder",
|
66 |
+
src=PROVIDERS,
|
67 |
+
dropdown_label="Select Provider",
|
68 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
if __name__ == "__main__":
|
71 |
+
demo.queue(api_open=False).launch(show_api=False)
|
app_gemini_coder.py
CHANGED
@@ -11,7 +11,7 @@ GEMINI_MODELS_DISPLAY = [k.replace("gemini:", "") for k in GEMINI_MODELS_FULL]
|
|
11 |
# Create and launch the interface using get_app utility
|
12 |
demo = get_app(
|
13 |
models=GEMINI_MODELS_FULL, # Use the full names with prefix
|
14 |
-
default_model=GEMINI_MODELS_FULL[-
|
15 |
dropdown_label="Select Gemini Model",
|
16 |
choices=GEMINI_MODELS_DISPLAY, # Display names without prefix
|
17 |
src=ai_gradio.registry,
|
|
|
11 |
# Create and launch the interface using get_app utility
|
12 |
demo = get_app(
|
13 |
models=GEMINI_MODELS_FULL, # Use the full names with prefix
|
14 |
+
default_model=GEMINI_MODELS_FULL[-1],
|
15 |
dropdown_label="Select Gemini Model",
|
16 |
choices=GEMINI_MODELS_DISPLAY, # Display names without prefix
|
17 |
src=ai_gradio.registry,
|
app_huggingface.py
CHANGED
@@ -1,21 +1,67 @@
|
|
1 |
-
import
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
# Get the hyperbolic models but keep their full names for loading
|
6 |
-
HUGGINGFACE_MODELS_FULL = [k for k in ai_gradio.registry.keys() if k.startswith("huggingface:")]
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
10 |
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_client import Client, handle_file
|
3 |
|
4 |
+
MODELS = {"SmolVLM-Instruct": "akhaliq/SmolVLM-Instruct"}
|
5 |
|
|
|
|
|
6 |
|
7 |
+
def create_chat_fn(client):
|
8 |
+
def chat(message, history):
|
9 |
+
# Extract text and files from the message
|
10 |
+
text = message.get("text", "")
|
11 |
+
files = message.get("files", [])
|
12 |
|
13 |
+
# Handle file uploads if present
|
14 |
+
processed_files = [handle_file(f) for f in files]
|
15 |
|
16 |
+
response = client.predict(
|
17 |
+
message={"text": text, "files": processed_files},
|
18 |
+
system_prompt="You are a helpful AI assistant.",
|
19 |
+
temperature=0.7,
|
20 |
+
max_new_tokens=1024,
|
21 |
+
top_k=40,
|
22 |
+
repetition_penalty=1.1,
|
23 |
+
top_p=0.95,
|
24 |
+
api_name="/chat",
|
25 |
+
)
|
26 |
+
return response
|
27 |
+
|
28 |
+
return chat
|
29 |
+
|
30 |
+
|
31 |
+
def set_client_for_session(model_name, request: gr.Request):
|
32 |
+
headers = {}
|
33 |
+
if request and hasattr(request, "headers"):
|
34 |
+
x_ip_token = request.headers.get("x-ip-token")
|
35 |
+
if x_ip_token:
|
36 |
+
headers["X-IP-Token"] = x_ip_token
|
37 |
+
|
38 |
+
return Client(MODELS[model_name], headers=headers)
|
39 |
+
|
40 |
+
|
41 |
+
def safe_chat_fn(message, history, client):
|
42 |
+
if client is None:
|
43 |
+
return "Error: Client not initialized. Please refresh the page."
|
44 |
+
try:
|
45 |
+
return create_chat_fn(client)(message, history)
|
46 |
+
except Exception as e:
|
47 |
+
print(f"Error during chat: {e!s}")
|
48 |
+
return f"Error during chat: {e!s}"
|
49 |
+
|
50 |
+
|
51 |
+
with gr.Blocks() as demo:
|
52 |
+
client = gr.State()
|
53 |
+
|
54 |
+
model_dropdown = gr.Dropdown(
|
55 |
+
choices=list(MODELS.keys()), value="SmolVLM-Instruct", label="Select Model", interactive=True
|
56 |
+
)
|
57 |
+
|
58 |
+
chat_interface = gr.ChatInterface(fn=safe_chat_fn, additional_inputs=[client], multimodal=True)
|
59 |
+
|
60 |
+
# Update client when model changes
|
61 |
+
model_dropdown.change(fn=set_client_for_session, inputs=[model_dropdown], outputs=[client])
|
62 |
+
|
63 |
+
# Initialize client on page load
|
64 |
+
demo.load(fn=set_client_for_session, inputs=[gr.State("SmolVLM-Instruct")], outputs=[client])
|
65 |
+
|
66 |
+
if __name__ == "__main__":
|
67 |
+
demo.launch()
|
app_hyperbolic.py
CHANGED
@@ -12,7 +12,7 @@ HYPERBOLIC_MODELS_DISPLAY = [k.replace("hyperbolic:", "") for k in HYPERBOLIC_MO
|
|
12 |
# Create and launch the interface using get_app utility
|
13 |
demo = get_app(
|
14 |
models=HYPERBOLIC_MODELS_FULL, # Use the full names with prefix
|
15 |
-
default_model=HYPERBOLIC_MODELS_FULL[-
|
16 |
dropdown_label="Select Hyperbolic Model",
|
17 |
choices=HYPERBOLIC_MODELS_DISPLAY, # Display names without prefix
|
18 |
fill_height=True,
|
|
|
12 |
# Create and launch the interface using get_app utility
|
13 |
demo = get_app(
|
14 |
models=HYPERBOLIC_MODELS_FULL, # Use the full names with prefix
|
15 |
+
default_model=HYPERBOLIC_MODELS_FULL[-1],
|
16 |
dropdown_label="Select Hyperbolic Model",
|
17 |
choices=HYPERBOLIC_MODELS_DISPLAY, # Display names without prefix
|
18 |
fill_height=True,
|
app_hyperbolic_coder.py
CHANGED
@@ -12,7 +12,7 @@ HYPERBOLIC_MODELS_DISPLAY = [k.replace("hyperbolic:", "") for k in HYPERBOLIC_MO
|
|
12 |
# Create and launch the interface using get_app utility
|
13 |
demo = get_app(
|
14 |
models=HYPERBOLIC_MODELS_FULL, # Use the full names with prefix
|
15 |
-
default_model=HYPERBOLIC_MODELS_FULL[-
|
16 |
dropdown_label="Select Hyperbolic Model",
|
17 |
choices=HYPERBOLIC_MODELS_DISPLAY, # Display names without prefix
|
18 |
fill_height=True,
|
|
|
12 |
# Create and launch the interface using get_app utility
|
13 |
demo = get_app(
|
14 |
models=HYPERBOLIC_MODELS_FULL, # Use the full names with prefix
|
15 |
+
default_model=HYPERBOLIC_MODELS_FULL[-1],
|
16 |
dropdown_label="Select Hyperbolic Model",
|
17 |
choices=HYPERBOLIC_MODELS_DISPLAY, # Display names without prefix
|
18 |
fill_height=True,
|
app_nvidia_coder.py
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
import ai_gradio
|
2 |
-
|
3 |
-
from utils_ai_gradio import get_app
|
4 |
-
|
5 |
-
# Get the nvidia models but keep their full names for loading
|
6 |
-
NVIDIA_MODELS_FULL = [k for k in ai_gradio.registry.keys() if k.startswith("nvidia:")]
|
7 |
-
|
8 |
-
# Create display names without the prefix
|
9 |
-
NVIDIA_MODELS_DISPLAY = [k.replace("nvidia:", "") for k in NVIDIA_MODELS_FULL]
|
10 |
-
|
11 |
-
|
12 |
-
# Create and launch the interface using get_app utility
|
13 |
-
demo = get_app(
|
14 |
-
models=NVIDIA_MODELS_FULL, # Use the full names with prefix
|
15 |
-
default_model=NVIDIA_MODELS_FULL[-1],
|
16 |
-
dropdown_label="Select Nvidia Model",
|
17 |
-
choices=NVIDIA_MODELS_DISPLAY, # Display names without prefix
|
18 |
-
fill_height=True,
|
19 |
-
coder=True
|
20 |
-
)
|
21 |
-
|
22 |
-
if __name__ == "__main__":
|
23 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app_openai_coder.py
CHANGED
@@ -11,7 +11,7 @@ OPENAI_MODELS_DISPLAY = [k.replace("openai:", "") for k in OPENAI_MODELS_FULL]
|
|
11 |
# Create and launch the interface using get_app utility
|
12 |
demo = get_app(
|
13 |
models=OPENAI_MODELS_FULL, # Use the full names with prefix
|
14 |
-
default_model=OPENAI_MODELS_FULL[
|
15 |
dropdown_label="Select OpenAI Model",
|
16 |
choices=OPENAI_MODELS_DISPLAY, # Display names without prefix
|
17 |
fill_height=True,
|
|
|
11 |
# Create and launch the interface using get_app utility
|
12 |
demo = get_app(
|
13 |
models=OPENAI_MODELS_FULL, # Use the full names with prefix
|
14 |
+
default_model=OPENAI_MODELS_FULL[5],
|
15 |
dropdown_label="Select OpenAI Model",
|
16 |
choices=OPENAI_MODELS_DISPLAY, # Display names without prefix
|
17 |
fill_height=True,
|
app_openrouter.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import ai_gradio
|
2 |
-
|
3 |
-
from utils_ai_gradio import get_app
|
4 |
-
|
5 |
-
# Get the OpenAI models but keep their full names for loading
|
6 |
-
OPENROUTER_MODELS_FULL = [k for k in ai_gradio.registry.keys() if k.startswith("openrouter:")]
|
7 |
-
|
8 |
-
# Create display names without the prefix
|
9 |
-
OPENROUTER_MODELS_DISPLAY = [k.replace("openrouter:", "") for k in OPENROUTER_MODELS_FULL]
|
10 |
-
|
11 |
-
# Create and launch the interface using get_app utility
|
12 |
-
demo = get_app(
|
13 |
-
models=OPENROUTER_MODELS_FULL, # Use the full names with prefix
|
14 |
-
default_model=OPENROUTER_MODELS_FULL[5],
|
15 |
-
dropdown_label="Select OpenRouter Model",
|
16 |
-
choices=OPENROUTER_MODELS_DISPLAY, # Display names without prefix
|
17 |
-
fill_height=True,
|
18 |
-
coder=True,
|
19 |
-
)
|
20 |
-
|
21 |
-
if __name__ == "__main__":
|
22 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app_qwen.py
CHANGED
@@ -1,19 +1,27 @@
|
|
1 |
-
import
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
QWEN_MODELS_FULL = [k for k in ai_gradio.registry.keys() if k.startswith("qwen:")]
|
7 |
|
8 |
-
# Create display names without the prefix
|
9 |
-
QWEN_MODELS_DISPLAY = [k.replace("qwen:", "") for k in QWEN_MODELS_FULL]
|
10 |
-
|
11 |
-
|
12 |
-
# Create and launch the interface using get_app utility
|
13 |
demo = get_app(
|
14 |
-
models=
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
)
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
|
3 |
+
import dashscope_gradio
|
4 |
|
5 |
+
from utils import get_app
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
7 |
demo = get_app(
|
8 |
+
models=[
|
9 |
+
"qwen-turbo-latest",
|
10 |
+
"qwen-turbo",
|
11 |
+
"qwen-plus",
|
12 |
+
"qwen-max",
|
13 |
+
"qwen1.5-110b-chat",
|
14 |
+
"qwen1.5-72b-chat",
|
15 |
+
"qwen1.5-32b-chat",
|
16 |
+
"qwen1.5-14b-chat",
|
17 |
+
"qwen1.5-7b-chat",
|
18 |
+
"qwq-32b-preview",
|
19 |
+
"qvq-72b-preview",
|
20 |
+
],
|
21 |
+
default_model="qvq-72b-preview",
|
22 |
+
src=dashscope_gradio.registry,
|
23 |
+
accept_token=not os.getenv("DASHSCOPE_API_KEY"),
|
24 |
)
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
demo.launch()
|
app_qwen_coder.py
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
import ai_gradio
|
2 |
-
|
3 |
-
from utils_ai_gradio import get_app
|
4 |
-
|
5 |
-
# Get the qwen models but keep their full names for loading
|
6 |
-
QWEN_MODELS_FULL = [k for k in ai_gradio.registry.keys() if k.startswith("qwen:")]
|
7 |
-
|
8 |
-
# Create display names without the prefix
|
9 |
-
QWEN_MODELS_DISPLAY = [k.replace("qwen:", "") for k in QWEN_MODELS_FULL]
|
10 |
-
|
11 |
-
|
12 |
-
# Create and launch the interface using get_app utility
|
13 |
-
demo = get_app(
|
14 |
-
models=QWEN_MODELS_FULL, # Use the full names with prefix
|
15 |
-
default_model=QWEN_MODELS_FULL[-1],
|
16 |
-
dropdown_label="Select Qwen Model",
|
17 |
-
choices=QWEN_MODELS_DISPLAY, # Display names without prefix
|
18 |
-
fill_height=True,
|
19 |
-
coder=True,
|
20 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app_sambanova.py
CHANGED
@@ -1,19 +1,28 @@
|
|
1 |
-
import
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
SAMBANOVA_MODELS_FULL = [k for k in ai_gradio.registry.keys() if k.startswith("sambanova:")]
|
7 |
|
8 |
-
# Create display names without the prefix
|
9 |
-
SAMBANOVA_MODELS_DISPLAY = [k.replace("sambanova:", "") for k in SAMBANOVA_MODELS_FULL]
|
10 |
-
|
11 |
-
|
12 |
-
# Create and launch the interface using get_app utility
|
13 |
demo = get_app(
|
14 |
-
models=
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
|
3 |
+
import sambanova_gradio
|
4 |
|
5 |
+
from utils import get_app
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
7 |
demo = get_app(
|
8 |
+
models=[
|
9 |
+
"Meta-Llama-3.2-1B-Instruct",
|
10 |
+
"Meta-Llama-3.2-3B-Instruct",
|
11 |
+
"Llama-3.2-11B-Vision-Instruct",
|
12 |
+
"Llama-3.2-90B-Vision-Instruct",
|
13 |
+
"Meta-Llama-3.1-8B-Instruct",
|
14 |
+
"Meta-Llama-3.1-70B-Instruct",
|
15 |
+
"Meta-Llama-3.1-405B-Instruct",
|
16 |
+
"Qwen2.5-72B-Instruct",
|
17 |
+
"Qwen2.5-Coder-32B-Instruct",
|
18 |
+
"Meta-Llama-3.3-70B-Instruct",
|
19 |
+
"QwQ-32B-Preview",
|
20 |
+
],
|
21 |
+
default_model="QwQ-32B-Preview",
|
22 |
+
src=sambanova_gradio.registry,
|
23 |
+
accept_token=not os.getenv("SAMBANOVA_API_KEY"),
|
24 |
+
multimodal=True,
|
25 |
+
)
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
demo.launch()
|
app_sambanova_coder.py
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
import ai_gradio
|
2 |
-
|
3 |
-
from utils_ai_gradio import get_app
|
4 |
-
|
5 |
-
# Get the hyperbolic models but keep their full names for loading
|
6 |
-
SAMBANOVA_MODELS_FULL = [k for k in ai_gradio.registry.keys() if k.startswith("sambanova:")]
|
7 |
-
|
8 |
-
# Create display names without the prefix
|
9 |
-
SAMBANOVA_MODELS_DISPLAY = [k.replace("sambanova:", "") for k in SAMBANOVA_MODELS_FULL]
|
10 |
-
|
11 |
-
|
12 |
-
# Create and launch the interface using get_app utility
|
13 |
-
demo = get_app(
|
14 |
-
models=SAMBANOVA_MODELS_FULL, # Use the full names with prefix
|
15 |
-
default_model=SAMBANOVA_MODELS_FULL[-1],
|
16 |
-
dropdown_label="Select Sambanova Model",
|
17 |
-
choices=SAMBANOVA_MODELS_DISPLAY, # Display names without prefix
|
18 |
-
fill_height=True,
|
19 |
-
coder=True,
|
20 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pyproject.toml
CHANGED
@@ -38,7 +38,7 @@ dependencies = [
|
|
38 |
"langchain>=0.3.14",
|
39 |
"chromadb>=0.5.23",
|
40 |
"openai>=1.55.0",
|
41 |
-
"ai-gradio[crewai,deepseek,gemini,groq,hyperbolic,openai,smolagents,transformers, langchain, mistral,minimax,nvidia
|
42 |
]
|
43 |
|
44 |
[tool.uv.sources]
|
|
|
38 |
"langchain>=0.3.14",
|
39 |
"chromadb>=0.5.23",
|
40 |
"openai>=1.55.0",
|
41 |
+
"ai-gradio[crewai,deepseek,gemini,groq,hyperbolic,openai,smolagents,transformers, langchain, mistral,minimax,nvidia]>=0.2.28",
|
42 |
]
|
43 |
|
44 |
[tool.uv.sources]
|
requirements.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# uv pip compile pyproject.toml -o requirements.txt
|
3 |
accelerate==1.2.1
|
4 |
# via ai-gradio
|
5 |
-
ai-gradio==0.2.
|
6 |
# via anychat (pyproject.toml)
|
7 |
aiofiles==23.2.1
|
8 |
# via gradio
|
@@ -428,10 +428,9 @@ httpx-sse==0.4.0
|
|
428 |
# langchain-community
|
429 |
httpx-ws==0.7.1
|
430 |
# via fireworks-ai
|
431 |
-
huggingface-hub==0.
|
432 |
# via
|
433 |
# accelerate
|
434 |
-
# ai-gradio
|
435 |
# gradio
|
436 |
# gradio-client
|
437 |
# tokenizers
|
|
|
2 |
# uv pip compile pyproject.toml -o requirements.txt
|
3 |
accelerate==1.2.1
|
4 |
# via ai-gradio
|
5 |
+
ai-gradio==0.2.28
|
6 |
# via anychat (pyproject.toml)
|
7 |
aiofiles==23.2.1
|
8 |
# via gradio
|
|
|
428 |
# langchain-community
|
429 |
httpx-ws==0.7.1
|
430 |
# via fireworks-ai
|
431 |
+
huggingface-hub==0.27.1
|
432 |
# via
|
433 |
# accelerate
|
|
|
434 |
# gradio
|
435 |
# gradio-client
|
436 |
# tokenizers
|