Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,48 +2,14 @@ import gradio as gr
|
|
2 |
import spaces
|
3 |
import transformers_gradio
|
4 |
|
5 |
-
# Load
|
6 |
-
|
7 |
-
|
8 |
-
"name": "allenai/Llama-3.1-Tulu-3-8B",
|
9 |
-
"src": transformers_gradio.registry
|
10 |
-
},
|
11 |
-
"OLMo": {
|
12 |
-
"name": "akhaliq/olmo-anychat",
|
13 |
-
"src": "spaces"
|
14 |
-
}
|
15 |
-
}
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
if model_choice == "Llama":
|
22 |
-
demo.fn = spaces.GPU()(demo.fn)
|
23 |
-
|
24 |
-
# Disable API names
|
25 |
-
for fn in demo.fns.values():
|
26 |
-
fn.api_name = False
|
27 |
-
|
28 |
-
return demo
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
-
|
32 |
-
model_dropdown = gr.Dropdown(
|
33 |
-
choices=list(models.keys()),
|
34 |
-
value="Llama",
|
35 |
-
label="Select Model"
|
36 |
-
)
|
37 |
-
|
38 |
-
demo_container = gr.Group()
|
39 |
-
|
40 |
-
def update_demo(model_choice):
|
41 |
-
return load_model(model_choice)
|
42 |
-
|
43 |
-
model_dropdown.change(
|
44 |
-
fn=update_demo,
|
45 |
-
inputs=[model_dropdown],
|
46 |
-
outputs=[demo_container]
|
47 |
-
)
|
48 |
-
|
49 |
-
interface.launch()
|
|
|
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 |
+
|
10 |
+
# Disable API names for both demos
|
11 |
+
for fn in demo.fns.values():
|
12 |
+
fn.api_name = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
if __name__ == "__main__":
|
15 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|