AiActivity commited on
Commit
1ba8f21
1 Parent(s): e360c3c

Upload 5 files

Browse files
Files changed (5) hide show
  1. app.py +66 -0
  2. app_sambanova.py +24 -0
  3. pyproject.toml +89 -0
  4. requirements.txt +325 -0
  5. utils.py +33 -0
app.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from app_sambanova_qwen import demo as demo_sambanova_qwen
3
+ from app_claude import demo as demo_claude
4
+ from app_fireworks import demo as demo_fireworks
5
+ from app_gemini import demo as demo_gemini
6
+ from app_groq import demo as demo_groq
7
+ from app_hf import demo as demo_hf
8
+ from app_hyperbolic import demo as demo_hyperbolic
9
+ from app_mistral import demo as demo_mistral
10
+ from app_nvidia import demo as demo_nvidia
11
+ from app_openai import demo as demo_openai
12
+ from app_perplexity import demo as demo_perplexity
13
+ from app_qwen import demo as demo_qwen
14
+ from app_sambanova import demo as demo_sambanova
15
+ from app_together import demo as demo_together
16
+ from app_xai import demo as demo_grok
17
+ from app_flux import demo as demo_flux
18
+ from app_ltx_video import demo as demo_ltx_video
19
+
20
+ with gr.Blocks(fill_height=True) as demo:
21
+ with gr.Tab("Meta Llama"):
22
+ demo_sambanova.render()
23
+ gr.Markdown(
24
+ "**Note:** You need to use a SambaNova API key from [SambaNova Cloud](https://cloud.sambanova.ai/)."
25
+ )
26
+ with gr.Tab("Gemini"):
27
+ demo_gemini.render()
28
+ with gr.Tab("LTX Video"):
29
+ demo_ltx_video.render()
30
+ with gr.Tab("ChatGPT"):
31
+ demo_openai.render()
32
+ with gr.Tab("Claude"):
33
+ demo_claude.render()
34
+ with gr.Tab("Grok"):
35
+ demo_grok.render()
36
+ with gr.Tab("Hugging Face"):
37
+ demo_hf.render()
38
+ with gr.Tab("Groq"):
39
+ demo_groq.render()
40
+ with gr.Tab("Hyperbolic"):
41
+ demo_hyperbolic.render()
42
+ gr.Markdown("""
43
+ <div>
44
+ <img src="https://storage.googleapis.com/public-arena-asset/hyperbolic_logo.png" alt="Hyperbolic Logo" style="height: 50px; margin-right: 10px;">
45
+ </div>
46
+
47
+ **Note:** This model is supported by Hyperbolic. Build your AI apps at [Hyperbolic](https://app.hyperbolic.xyz/).
48
+ """)
49
+ with gr.Tab("Qwen"):
50
+ demo_qwen.render()
51
+ with gr.Tab("Perplexity"):
52
+ demo_perplexity.render()
53
+ with gr.Tab("Mistral"):
54
+ demo_mistral.render()
55
+ with gr.Tab("Fireworks"):
56
+ demo_fireworks.render()
57
+ with gr.Tab("Together"):
58
+ demo_together.render()
59
+ with gr.Tab("NVIDIA"):
60
+ demo_nvidia.render()
61
+ with gr.Tab("Flux"):
62
+ demo_flux.render()
63
+
64
+
65
+ if __name__ == "__main__":
66
+ demo.queue(api_open=False).launch(ssr_mode=False, show_api=False)
app_sambanova.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ],
17
+ default_model="Llama-3.2-90B-Vision-Instruct",
18
+ src=sambanova_gradio.registry,
19
+ accept_token=not os.getenv("SAMBANOVA_API_KEY"),
20
+ multimodal=True,
21
+ )
22
+
23
+ if __name__ == "__main__":
24
+ demo.launch()
pyproject.toml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "anychat"
3
+ version = "0.1.0"
4
+ description = ""
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "anthropic-gradio",
9
+ "cerebras-gradio",
10
+ "dashscope-gradio",
11
+ "fireworks-gradio",
12
+ "gemini-gradio>=0.0.1",
13
+ "gradio>=5.6.0",
14
+ "groq-gradio>=0.0.2",
15
+ "hyperbolic-gradio>=0.0.4",
16
+ "mistral-gradio>=0.0.2",
17
+ "nvidia-gradio",
18
+ "openai-gradio>=0.0.4",
19
+ "perplexity-gradio>=0.0.1",
20
+ "sambanova-gradio>=0.1.9",
21
+ "together-gradio>=0.0.1",
22
+ "xai-gradio>=0.0.2",
23
+ ]
24
+
25
+ [tool.uv.sources]
26
+ anthropic-gradio = { git = "https://github.com/AK391/anthropic-gradio.git" }
27
+ fireworks-gradio = { git = "https://github.com/AK391/fireworks-ai-gradio.git" }
28
+ cerebras-gradio = { git = "https://github.com/gradio-app/cerebras_gradio.git" }
29
+ nvidia-gradio = { git = "https://github.com/AK391/nvidia-gradio.git" }
30
+ dashscope-gradio = { git = "https://github.com/AK391/dashscope-gradio.git" }
31
+
32
+ [tool.ruff]
33
+ # Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
34
+ select = ["E", "F"]
35
+ ignore = ["E501"] # line too long (black is taking care of this)
36
+ line-length = 119
37
+ fixable = [
38
+ "A",
39
+ "B",
40
+ "C",
41
+ "D",
42
+ "E",
43
+ "F",
44
+ "G",
45
+ "I",
46
+ "N",
47
+ "Q",
48
+ "S",
49
+ "T",
50
+ "W",
51
+ "ANN",
52
+ "ARG",
53
+ "BLE",
54
+ "COM",
55
+ "DJ",
56
+ "DTZ",
57
+ "EM",
58
+ "ERA",
59
+ "EXE",
60
+ "FBT",
61
+ "ICN",
62
+ "INP",
63
+ "ISC",
64
+ "NPY",
65
+ "PD",
66
+ "PGH",
67
+ "PIE",
68
+ "PL",
69
+ "PT",
70
+ "PTH",
71
+ "PYI",
72
+ "RET",
73
+ "RSE",
74
+ "RUF",
75
+ "SIM",
76
+ "SLF",
77
+ "TCH",
78
+ "TID",
79
+ "TRY",
80
+ "UP",
81
+ "YTT",
82
+ ]
83
+
84
+ [tool.isort]
85
+ profile = "black"
86
+ line_length = 119
87
+
88
+ [tool.black]
89
+ line-length = 119
requirements.txt ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file was autogenerated by uv via the following command:
2
+ # uv pip compile pyproject.toml -o requirements.txt
3
+ aiofiles==23.2.1
4
+ # via gradio
5
+ annotated-types==0.7.0
6
+ # via pydantic
7
+ anthropic==0.39.0
8
+ # via anthropic-gradio
9
+ anthropic-gradio @ git+https://github.com/AK391/anthropic-gradio.git@34e5622031487ea207073177b4ec1f3067936295
10
+ # via anychat (pyproject.toml)
11
+ anyio==4.6.2.post1
12
+ # via
13
+ # anthropic
14
+ # cerebras-cloud-sdk
15
+ # gradio
16
+ # groq
17
+ # httpx
18
+ # openai
19
+ # starlette
20
+ cachetools==5.5.0
21
+ # via google-auth
22
+ cerebras-cloud-sdk==1.12.1
23
+ # via cerebras-gradio
24
+ cerebras-gradio @ git+https://github.com/gradio-app/cerebras_gradio.git@0135ea37048281ca4fae2d6a90311be3b38954ae
25
+ # via anychat (pyproject.toml)
26
+ certifi==2024.8.30
27
+ # via
28
+ # httpcore
29
+ # httpx
30
+ # requests
31
+ charset-normalizer==3.4.0
32
+ # via requests
33
+ click==8.1.7
34
+ # via
35
+ # typer
36
+ # uvicorn
37
+ dashscope-gradio @ git+https://github.com/AK391/dashscope-gradio.git@3a8bab36087cbf5efcde17c695a10e0229784db4
38
+ # via anychat (pyproject.toml)
39
+ distro==1.9.0
40
+ # via
41
+ # anthropic
42
+ # cerebras-cloud-sdk
43
+ # groq
44
+ # openai
45
+ eval-type-backport==0.2.0
46
+ # via mistralai
47
+ exceptiongroup==1.2.2
48
+ # via anyio
49
+ fastapi==0.115.5
50
+ # via gradio
51
+ ffmpy==0.4.0
52
+ # via gradio
53
+ filelock==3.16.1
54
+ # via huggingface-hub
55
+ fireworks-gradio @ git+https://github.com/AK391/fireworks-ai-gradio.git@b85f85bfe777a7ec953c8b996536e1d1cd47ae08
56
+ # via anychat (pyproject.toml)
57
+ fsspec==2024.10.0
58
+ # via
59
+ # gradio-client
60
+ # huggingface-hub
61
+ gemini-gradio==0.0.1
62
+ # via anychat (pyproject.toml)
63
+ google-ai-generativelanguage==0.6.10
64
+ # via google-generativeai
65
+ google-api-core==2.23.0
66
+ # via
67
+ # google-ai-generativelanguage
68
+ # google-api-python-client
69
+ # google-generativeai
70
+ google-api-python-client==2.154.0
71
+ # via google-generativeai
72
+ google-auth==2.36.0
73
+ # via
74
+ # google-ai-generativelanguage
75
+ # google-api-core
76
+ # google-api-python-client
77
+ # google-auth-httplib2
78
+ # google-generativeai
79
+ google-auth-httplib2==0.2.0
80
+ # via google-api-python-client
81
+ google-generativeai==0.8.3
82
+ # via gemini-gradio
83
+ googleapis-common-protos==1.66.0
84
+ # via
85
+ # google-api-core
86
+ # grpcio-status
87
+ gradio==5.6.0
88
+ # via
89
+ # anychat (pyproject.toml)
90
+ # anthropic-gradio
91
+ # cerebras-gradio
92
+ # dashscope-gradio
93
+ # fireworks-gradio
94
+ # gemini-gradio
95
+ # groq-gradio
96
+ # hyperbolic-gradio
97
+ # mistral-gradio
98
+ # nvidia-gradio
99
+ # openai-gradio
100
+ # perplexity-gradio
101
+ # sambanova-gradio
102
+ # together-gradio
103
+ # xai-gradio
104
+ gradio-client==1.4.3
105
+ # via gradio
106
+ groq==0.12.0
107
+ # via groq-gradio
108
+ groq-gradio==0.0.2
109
+ # via anychat (pyproject.toml)
110
+ grpcio==1.68.0
111
+ # via
112
+ # google-api-core
113
+ # grpcio-status
114
+ grpcio-status==1.68.0
115
+ # via google-api-core
116
+ h11==0.14.0
117
+ # via
118
+ # httpcore
119
+ # uvicorn
120
+ httpcore==1.0.7
121
+ # via httpx
122
+ httplib2==0.22.0
123
+ # via
124
+ # google-api-python-client
125
+ # google-auth-httplib2
126
+ httpx==0.27.2
127
+ # via
128
+ # anthropic
129
+ # cerebras-cloud-sdk
130
+ # gradio
131
+ # gradio-client
132
+ # groq
133
+ # mistralai
134
+ # openai
135
+ # safehttpx
136
+ huggingface-hub==0.26.2
137
+ # via
138
+ # gradio
139
+ # gradio-client
140
+ hyperbolic-gradio==0.0.4
141
+ # via anychat (pyproject.toml)
142
+ idna==3.10
143
+ # via
144
+ # anyio
145
+ # httpx
146
+ # requests
147
+ jinja2==3.1.4
148
+ # via gradio
149
+ jiter==0.7.1
150
+ # via
151
+ # anthropic
152
+ # openai
153
+ jsonpath-python==1.0.6
154
+ # via mistralai
155
+ markdown-it-py==3.0.0
156
+ # via rich
157
+ markupsafe==2.1.5
158
+ # via
159
+ # gradio
160
+ # jinja2
161
+ mdurl==0.1.2
162
+ # via markdown-it-py
163
+ mistral-gradio==0.0.2
164
+ # via anychat (pyproject.toml)
165
+ mistralai==1.2.3
166
+ # via mistral-gradio
167
+ mypy-extensions==1.0.0
168
+ # via typing-inspect
169
+ numpy==2.1.3
170
+ # via
171
+ # gradio
172
+ # pandas
173
+ nvidia-gradio @ git+https://github.com/AK391/nvidia-gradio.git@735cc0ba06afb44eeef789d8c0c35b1fc61fee16
174
+ # via anychat (pyproject.toml)
175
+ openai==1.55.0
176
+ # via
177
+ # dashscope-gradio
178
+ # fireworks-gradio
179
+ # hyperbolic-gradio
180
+ # nvidia-gradio
181
+ # openai-gradio
182
+ # perplexity-gradio
183
+ # sambanova-gradio
184
+ # together-gradio
185
+ # xai-gradio
186
+ openai-gradio==0.0.4
187
+ # via anychat (pyproject.toml)
188
+ orjson==3.10.11
189
+ # via gradio
190
+ packaging==24.2
191
+ # via
192
+ # gradio
193
+ # gradio-client
194
+ # huggingface-hub
195
+ pandas==2.2.3
196
+ # via gradio
197
+ perplexity-gradio==0.0.1
198
+ # via anychat (pyproject.toml)
199
+ pillow==11.0.0
200
+ # via gradio
201
+ proto-plus==1.25.0
202
+ # via
203
+ # google-ai-generativelanguage
204
+ # google-api-core
205
+ protobuf==5.28.3
206
+ # via
207
+ # google-ai-generativelanguage
208
+ # google-api-core
209
+ # google-generativeai
210
+ # googleapis-common-protos
211
+ # grpcio-status
212
+ # proto-plus
213
+ pyasn1==0.6.1
214
+ # via
215
+ # pyasn1-modules
216
+ # rsa
217
+ pyasn1-modules==0.4.1
218
+ # via google-auth
219
+ pydantic==2.10.0
220
+ # via
221
+ # anthropic
222
+ # cerebras-cloud-sdk
223
+ # fastapi
224
+ # google-generativeai
225
+ # gradio
226
+ # groq
227
+ # mistralai
228
+ # openai
229
+ pydantic-core==2.27.0
230
+ # via pydantic
231
+ pydub==0.25.1
232
+ # via gradio
233
+ pygments==2.18.0
234
+ # via rich
235
+ pyparsing==3.2.0
236
+ # via httplib2
237
+ python-dateutil==2.8.2
238
+ # via
239
+ # mistralai
240
+ # pandas
241
+ python-multipart==0.0.12
242
+ # via gradio
243
+ pytz==2024.2
244
+ # via pandas
245
+ pyyaml==6.0.2
246
+ # via
247
+ # gradio
248
+ # huggingface-hub
249
+ requests==2.32.3
250
+ # via
251
+ # google-api-core
252
+ # huggingface-hub
253
+ rich==13.9.4
254
+ # via typer
255
+ rsa==4.9
256
+ # via google-auth
257
+ ruff==0.7.4
258
+ # via gradio
259
+ safehttpx==0.1.1
260
+ # via gradio
261
+ sambanova-gradio==0.1.9
262
+ # via anychat (pyproject.toml)
263
+ semantic-version==2.10.0
264
+ # via gradio
265
+ shellingham==1.5.4
266
+ # via typer
267
+ six==1.16.0
268
+ # via python-dateutil
269
+ sniffio==1.3.1
270
+ # via
271
+ # anthropic
272
+ # anyio
273
+ # cerebras-cloud-sdk
274
+ # groq
275
+ # httpx
276
+ # openai
277
+ starlette==0.41.3
278
+ # via
279
+ # fastapi
280
+ # gradio
281
+ together-gradio==0.0.1
282
+ # via anychat (pyproject.toml)
283
+ tomlkit==0.12.0
284
+ # via gradio
285
+ tqdm==4.67.0
286
+ # via
287
+ # google-generativeai
288
+ # huggingface-hub
289
+ # openai
290
+ typer==0.13.1
291
+ # via gradio
292
+ typing-extensions==4.12.2
293
+ # via
294
+ # anthropic
295
+ # anyio
296
+ # cerebras-cloud-sdk
297
+ # fastapi
298
+ # google-generativeai
299
+ # gradio
300
+ # gradio-client
301
+ # groq
302
+ # huggingface-hub
303
+ # openai
304
+ # pydantic
305
+ # pydantic-core
306
+ # rich
307
+ # typer
308
+ # typing-inspect
309
+ # uvicorn
310
+ typing-inspect==0.9.0
311
+ # via mistralai
312
+ tzdata==2024.2
313
+ # via pandas
314
+ uritemplate==4.1.1
315
+ # via google-api-python-client
316
+ urllib3==2.2.3
317
+ # via requests
318
+ uvicorn==0.32.1
319
+ # via gradio
320
+ websockets==12.0
321
+ # via gradio-client
322
+ xai-gradio==0.0.2
323
+ # via anychat (pyproject.toml)
324
+ replicate-gradio @ git+https://github.com/AK391/replicate-gradio.git
325
+ fal-gradio @ git+https://github.com/AK391/fal-gradio.git
utils.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable, Literal
2
+
3
+ import gradio as gr
4
+
5
+
6
+ def get_app(
7
+ models: list[str],
8
+ default_model: str,
9
+ src: Callable[[str, str | None], gr.Blocks] | Literal["models"],
10
+ accept_token: bool = False,
11
+ **kwargs,
12
+ ) -> gr.Blocks:
13
+ def update_model(new_model: str) -> list[gr.Column]:
14
+ return [gr.Column(visible=model_name == new_model) for model_name in models]
15
+
16
+ with gr.Blocks() as demo:
17
+ model = gr.Dropdown(label="Select Model", choices=models, value=default_model)
18
+
19
+ columns = []
20
+ for model_name in models:
21
+ with gr.Column(visible=model_name == default_model) as column:
22
+ gr.load(name=model_name, src=src, accept_token=accept_token, **kwargs)
23
+ columns.append(column)
24
+
25
+ model.change(
26
+ fn=update_model,
27
+ inputs=model,
28
+ outputs=columns,
29
+ api_name=False,
30
+ queue=False,
31
+ )
32
+
33
+ return demo