Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,23 +16,35 @@ with gr.Blocks() as demo:
|
|
16 |
label="Select Model"
|
17 |
)
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
# Disable API names
|
31 |
for fn in demo.fns.values():
|
32 |
fn.api_name = False
|
33 |
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
demo.launch()
|
|
|
16 |
label="Select Model"
|
17 |
)
|
18 |
|
19 |
+
# Create columns for each model
|
20 |
+
with gr.Column(visible=True) as llama_column:
|
21 |
+
llama_chat = gr.ChatInterface(
|
22 |
+
lambda message, history: str(next(llama_demo.fn(message)))
|
23 |
+
)
|
24 |
+
|
25 |
+
with gr.Column(visible=False) as olmo_column:
|
26 |
+
olmo_chat = gr.ChatInterface(
|
27 |
+
lambda message, history: str(next(olmo_demo.fn(message)))
|
28 |
+
)
|
29 |
+
|
30 |
+
# Update visibility when model changes
|
31 |
+
def update_model(new_model):
|
32 |
+
return [
|
33 |
+
gr.Column(visible=new_model == "allenai/Llama-3.1-Tulu-3-8B"),
|
34 |
+
gr.Column(visible=new_model == "akhaliq/olmo-anychat")
|
35 |
+
]
|
36 |
+
|
37 |
+
model_dropdown.change(
|
38 |
+
fn=update_model,
|
39 |
+
inputs=model_dropdown,
|
40 |
+
outputs=[llama_column, olmo_column],
|
41 |
+
api_name=False,
|
42 |
+
queue=False,
|
43 |
+
)
|
44 |
|
45 |
# Disable API names
|
46 |
for fn in demo.fns.values():
|
47 |
fn.api_name = False
|
48 |
|
49 |
|
|
|
|
|
|
|
50 |
demo.launch()
|