File size: 1,017 Bytes
5ea344f
 
 
 
07eef74
 
5ea344f
07eef74
963672f
bb2a7e9
07eef74
 
 
 
 
 
 
 
 
 
 
5aeaad2
 
 
07eef74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5aeaad2
2201358
48a8102
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import gradio as gr
import spaces
import transformers_gradio

# Load Llama model
demo = gr.load(name="akhaliq/allen-test", src="spaces")

# Load OLMo model
olmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces")

# Disable API names for both demos
for fn in demo.fns.values():
    fn.api_name = False
for fn in olmo_demo.fns.values():
    fn.api_name = False

# Create a dropdown to select the model
with gr.Blocks() as combined_demo:
    model_choice = gr.Dropdown(
        choices=["Llama", "OLMo"],
        value="Llama",
        label="Select Model"
    )
    
    with gr.Tab("Model Interface"):
        # Create placeholder for the selected model's interface
        placeholder = gr.HTML()
        
        def update_interface(choice):
            if choice == "Llama":
                return demo
            else:
                return olmo_demo
        
        model_choice.change(
            fn=update_interface,
            inputs=[model_choice],
            outputs=[placeholder]
        )