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