akhaliq HF staff commited on
Commit
4710b81
1 Parent(s): 47bb65f
Files changed (2) hide show
  1. app_allenai.py +8 -37
  2. app_perplexity.py +1 -1
app_allenai.py CHANGED
@@ -1,42 +1,13 @@
1
  import gradio as gr
2
  import spaces
3
- import transformers_gradio
4
-
5
- # Load Llama model
6
- demo = gr.load(name="akhaliq/allen-test", src="spaces")
7
-
8
- # Load OLMo model
9
- olmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces")
10
-
11
- # Disable API names for both demos
12
- for fn in demo.fns.values():
13
- fn.api_name = False
14
- for fn in olmo_demo.fns.values():
15
- fn.api_name = False
16
-
17
- # Create a dropdown to select the model
18
- with gr.Blocks() as combined_demo:
19
- model_choice = gr.Dropdown(
20
- choices=["Llama", "OLMo"],
21
- value="Llama",
22
- label="Select Model"
23
- )
24
-
25
- with gr.Tab("Model Interface"):
26
- # Create placeholder for the selected model's interface
27
- placeholder = gr.HTML()
28
-
29
- def update_interface(choice):
30
- if choice == "Llama":
31
- return demo
32
- else:
33
- return olmo_demo
34
-
35
- model_choice.change(
36
- fn=update_interface,
37
- inputs=[model_choice],
38
- outputs=[placeholder]
39
- )
40
 
41
 
42
 
 
1
  import gradio as gr
2
  import spaces
3
+ from utils import get_app
4
+
5
+ # Create the combined demo using the utility function
6
+ demo = get_app(
7
+ models=["akhaliq/allen-test", "akhaliq/olmo-anychat"],
8
+ default_model="akhaliq/allen-test",
9
+ src="spaces"
10
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
 
13
 
app_perplexity.py CHANGED
@@ -14,7 +14,7 @@ demo = get_app(
14
  "llama-3.1-8b-instruct",
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
  )
 
14
  "llama-3.1-8b-instruct",
15
  "llama-3.1-70b-instruct",
16
  ],
17
+ default_model="llama-3.1-sonar-huge-128k-online",
18
  src=perplexity_gradio.registry,
19
  accept_token=not os.getenv("PERPLEXITY_API_KEY"),
20
  )