Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,18 @@
|
|
1 |
-
import gradio as gr, transformers
|
2 |
-
|
3 |
-
pipe = transformers.pipeline("text-generation",
|
4 |
-
model="marcelbinz/Llama-3.1-Minitaur-8B")
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
demo.launch()
|
|
|
1 |
+
import gradio as gr, transformers
|
2 |
+
|
3 |
+
pipe = transformers.pipeline("text-generation",
|
4 |
+
model="marcelbinz/Llama-3.1-Minitaur-8B")
|
5 |
+
pipe.to('cuda')
|
6 |
+
|
7 |
+
@spaces.GPU
|
8 |
+
def infer(prompt, max_tokens):
|
9 |
+
return pipe(prompt, max_new_tokens=int(max_tokens))[0]["generated_text"]
|
10 |
+
|
11 |
+
demo = gr.Interface(
|
12 |
+
fn=infer,
|
13 |
+
inputs=gr.Text(),
|
14 |
+
outputs="text",
|
15 |
+
title="Minitaur",
|
16 |
+
description="Just type and hit *Run*"
|
17 |
+
)
|
18 |
demo.launch()
|