hysts HF staff commited on
Commit
dc944d5
1 Parent(s): e8fb5c0
app_cerebras.py CHANGED
@@ -11,7 +11,7 @@ demo = get_app(
11
  "llama3.1-405b",
12
  ],
13
  default_model="llama3.1-70b",
14
- registry=cerebras_gradio.registry,
15
  accept_token=not os.getenv("CEREBRAS_API_KEY"),
16
  )
17
 
 
11
  "llama3.1-405b",
12
  ],
13
  default_model="llama3.1-70b",
14
+ src=cerebras_gradio.registry,
15
  accept_token=not os.getenv("CEREBRAS_API_KEY"),
16
  )
17
 
app_claude.py CHANGED
@@ -13,7 +13,7 @@ demo = get_app(
13
  "claude-3-haiku-20240307",
14
  ],
15
  default_model="claude-3-5-sonnet-20241022",
16
- registry=anthropic_gradio.registry,
17
  accept_token=not os.getenv("ANTHROPIC_API_KEY"),
18
  )
19
 
 
13
  "claude-3-haiku-20240307",
14
  ],
15
  default_model="claude-3-5-sonnet-20241022",
16
+ src=anthropic_gradio.registry,
17
  accept_token=not os.getenv("ANTHROPIC_API_KEY"),
18
  )
19
 
app_fireworks.py CHANGED
@@ -10,7 +10,7 @@ demo = get_app(
10
  "f1-mini-preview",
11
  ],
12
  default_model="f1-preview",
13
- registry=fireworks_gradio.registry,
14
  accept_token=not os.getenv("FIREWORKS_API_KEY"),
15
  )
16
 
 
10
  "f1-mini-preview",
11
  ],
12
  default_model="f1-preview",
13
+ src=fireworks_gradio.registry,
14
  accept_token=not os.getenv("FIREWORKS_API_KEY"),
15
  )
16
 
app_gemini.py CHANGED
@@ -12,7 +12,7 @@ demo = get_app(
12
  "gemini-exp-1114",
13
  ],
14
  default_model="gemini-1.5-pro",
15
- registry=gemini_gradio.registry,
16
  accept_token=not os.getenv("GEMINI_API_KEY"),
17
  )
18
 
 
12
  "gemini-exp-1114",
13
  ],
14
  default_model="gemini-1.5-pro",
15
+ src=gemini_gradio.registry,
16
  accept_token=not os.getenv("GEMINI_API_KEY"),
17
  )
18
 
app_groq.py CHANGED
@@ -17,7 +17,7 @@ demo = get_app(
17
  "gemma-7b-it",
18
  ],
19
  default_model="llama3-groq-70b-8192-tool-use-preview",
20
- registry=groq_gradio.registry,
21
  accept_token=not os.getenv("GROQ_API_KEY"),
22
  )
23
 
 
17
  "gemma-7b-it",
18
  ],
19
  default_model="llama3-groq-70b-8192-tool-use-preview",
20
+ src=groq_gradio.registry,
21
  accept_token=not os.getenv("GROQ_API_KEY"),
22
  )
23
 
app_hf.py CHANGED
@@ -21,7 +21,7 @@ demo = get_app(
21
  "openai-community/gpt2",
22
  ],
23
  default_model="HuggingFaceTB/SmolLM2-1.7B-Instruct",
24
- registry="models",
25
  )
26
 
27
  if __name__ == "__main__":
 
21
  "openai-community/gpt2",
22
  ],
23
  default_model="HuggingFaceTB/SmolLM2-1.7B-Instruct",
24
+ src="models",
25
  )
26
 
27
  if __name__ == "__main__":
app_hyperbolic.py CHANGED
@@ -17,7 +17,7 @@ demo = get_app(
17
  "meta-llama/Meta-Llama-3.1-405B-Instruct",
18
  ],
19
  default_model="Qwen/Qwen2.5-Coder-32B-Instruct",
20
- registry=hyperbolic_gradio.registry,
21
  accept_token=not os.getenv("HYPERBOLIC_API_KEY"),
22
  )
23
 
 
17
  "meta-llama/Meta-Llama-3.1-405B-Instruct",
18
  ],
19
  default_model="Qwen/Qwen2.5-Coder-32B-Instruct",
20
+ src=hyperbolic_gradio.registry,
21
  accept_token=not os.getenv("HYPERBOLIC_API_KEY"),
22
  )
23
 
app_mistral.py CHANGED
@@ -19,7 +19,7 @@ demo = get_app(
19
  "open-codestral-mamba",
20
  ],
21
  default_model="pixtral-large-latest",
22
- registry=mistral_gradio.registry,
23
  accept_token=not os.getenv("MISTRAL_API_KEY"),
24
  )
25
 
 
19
  "open-codestral-mamba",
20
  ],
21
  default_model="pixtral-large-latest",
22
+ src=mistral_gradio.registry,
23
  accept_token=not os.getenv("MISTRAL_API_KEY"),
24
  )
25
 
app_nvidia.py CHANGED
@@ -44,7 +44,7 @@ demo = get_app(
44
  "snowflake/arctic",
45
  ],
46
  default_model="meta/llama-3.1-70b-instruct",
47
- registry=nvidia_gradio.registry,
48
  accept_token=not os.getenv("NVIDIA_API_KEY"),
49
  )
50
 
 
44
  "snowflake/arctic",
45
  ],
46
  default_model="meta/llama-3.1-70b-instruct",
47
+ src=nvidia_gradio.registry,
48
  accept_token=not os.getenv("NVIDIA_API_KEY"),
49
  )
50
 
app_openai.py CHANGED
@@ -26,7 +26,7 @@ demo = get_app(
26
  "gpt-4-0613",
27
  ],
28
  default_model="gpt-4o-2024-11-20",
29
- registry=openai_gradio.registry,
30
  accept_token=not os.getenv("OPENAI_API_KEY"),
31
  )
32
 
 
26
  "gpt-4-0613",
27
  ],
28
  default_model="gpt-4o-2024-11-20",
29
+ src=openai_gradio.registry,
30
  accept_token=not os.getenv("OPENAI_API_KEY"),
31
  )
32
 
app_perplexity.py CHANGED
@@ -15,7 +15,7 @@ demo = get_app(
15
  "llama-3.1-70b-instruct",
16
  ],
17
  default_model="llama-3.1-sonar-large-128k-online",
18
- registry=perplexity_gradio.registry,
19
  accept_token=not os.getenv("PERPLEXITY_API_KEY"),
20
  )
21
 
 
15
  "llama-3.1-70b-instruct",
16
  ],
17
  default_model="llama-3.1-sonar-large-128k-online",
18
+ src=perplexity_gradio.registry,
19
  accept_token=not os.getenv("PERPLEXITY_API_KEY"),
20
  )
21
 
app_qwen.py CHANGED
@@ -17,7 +17,7 @@ demo = get_app(
17
  "qwen1.5-7b-chat",
18
  ],
19
  default_model="qwen-turbo-latest",
20
- registry=dashscope_gradio.registry,
21
  accept_token=not os.getenv("DASHSCOPE_API_KEY"),
22
  )
23
 
 
17
  "qwen1.5-7b-chat",
18
  ],
19
  default_model="qwen-turbo-latest",
20
+ src=dashscope_gradio.registry,
21
  accept_token=not os.getenv("DASHSCOPE_API_KEY"),
22
  )
23
 
app_sambanova.py CHANGED
@@ -15,7 +15,7 @@ demo = get_app(
15
  "Meta-Llama-3.1-405B-Instruct",
16
  ],
17
  default_model="Llama-3.2-90B-Vision-Instruct",
18
- registry=sambanova_gradio.registry,
19
  accept_token=not os.getenv("SAMBANOVA_API_KEY"),
20
  multimodal=True,
21
  )
 
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
  )
app_together.py CHANGED
@@ -42,7 +42,7 @@ demo = get_app(
42
  "upstage/SOLAR-10.7B-Instruct-v1.0",
43
  ],
44
  default_model="meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo",
45
- registry=together_gradio.registry,
46
  accept_token=not os.getenv("TOGETHER_API_KEY"),
47
  multimodal=True,
48
  )
 
42
  "upstage/SOLAR-10.7B-Instruct-v1.0",
43
  ],
44
  default_model="meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo",
45
+ src=together_gradio.registry,
46
  accept_token=not os.getenv("TOGETHER_API_KEY"),
47
  multimodal=True,
48
  )
app_xai.py CHANGED
@@ -10,7 +10,7 @@ demo = get_app(
10
  "grok-vision-beta",
11
  ],
12
  default_model="grok-vision-beta",
13
- registry=xai_gradio.registry,
14
  accept_token=not os.getenv("XAI_API_KEY"),
15
  )
16
 
 
10
  "grok-vision-beta",
11
  ],
12
  default_model="grok-vision-beta",
13
+ src=xai_gradio.registry,
14
  accept_token=not os.getenv("XAI_API_KEY"),
15
  )
16
 
utils.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Callable
2
 
3
  import gradio as gr
4
 
@@ -6,7 +6,7 @@ import gradio as gr
6
  def get_app(
7
  models: list[str],
8
  default_model: str,
9
- registry: Callable,
10
  accept_token: bool = False,
11
  **kwargs,
12
  ) -> gr.Blocks:
@@ -19,7 +19,7 @@ def get_app(
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=registry, accept_token=accept_token, **kwargs)
23
  columns.append(column)
24
 
25
  model.change(
 
1
+ from typing import Callable, Literal
2
 
3
  import gradio as gr
4
 
 
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:
 
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(