Spaces:
Runtime error
Runtime error
update allen ai dropdown
Browse files- 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 |
-
|
7 |
-
|
8 |
|
9 |
# Load OLMo model
|
10 |
olmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces")
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
# Disable API names
|
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 |
-
|
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 |
+
|
|
|
|