akhaliq HF staff commited on
Commit
48a8102
1 Parent(s): de54fe0

update allen ai dropdown

Browse files
Files changed (1) hide show
  1. app_allenai.py +11 -8
app_allenai.py CHANGED
@@ -1,21 +1,24 @@
1
  import gradio as gr
2
  import spaces
3
  import transformers_gradio
 
4
 
5
  # Load Llama model
6
- demo = gr.load(name="allenai/Llama-3.1-Tulu-3-8B", src=transformers_gradio.registry)
7
- demo.fn = spaces.GPU()(demo.fn)
8
 
9
  # Load OLMo model
10
  olmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces")
11
 
 
 
 
 
 
 
12
 
13
- # Disable API names for both demos
14
  for fn in demo.fns.values():
15
  fn.api_name = False
16
- for fn in olmo_demo.fns.values():
17
- fn.api_name = False
18
 
19
- if __name__ == "__main__":
20
- # Launch both demos
21
- gr.TabbedInterface([demo, olmo_demo], ["Llama", "OLMo"]).launch()
 
1
  import gradio as gr
2
  import spaces
3
  import transformers_gradio
4
+ from utils import get_app
5
 
6
  # Load Llama model
7
+ llama_demo = gr.load(name="allenai/Llama-3.1-Tulu-3-8B", src=transformers_gradio.registry)
8
+ llama_demo.fn = spaces.GPU()(llama_demo.fn)
9
 
10
  # Load OLMo model
11
  olmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces")
12
 
13
+ # Create combined demo with dropdown
14
+ demo = get_app(
15
+ models=["allenai/Llama-3.1-Tulu-3-8B", "akhaliq/olmo-anychat"],
16
+ default_model="allenai/Llama-3.1-Tulu-3-8B",
17
+ src=lambda name, _: llama_demo if name == "allenai/Llama-3.1-Tulu-3-8B" else olmo_demo
18
+ )
19
 
20
+ # Disable API names
21
  for fn in demo.fns.values():
22
  fn.api_name = False
 
 
23
 
24
+