File size: 537 Bytes
2e01190
 
 
 
9704a98
65872c0
 
 
 
 
 
9704a98
 
bb856a6
5591535
9704a98
 
 
 
 
 
 
5591535
69649ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import spaces
import gradio as gr
import torch
from transformers import pipeline

pipe = pipeline(
    "text-generation",
    model="marcelbinz/Llama-3.1-Minitaur-8B",
    device_map="auto",
    torch_dtype=torch.bfloat16
)

@spaces.GPU
def infer(prompt):
    return pipe(prompt, max_new_tokens=1, do_sample=True, temperature=1.0)[0]["generated_text"]

demo = gr.Interface(
        fn=infer,
        inputs=gr.Text(),
        outputs="text",
        title="Minitaur",
        description="Just type and hit *Run*"
).queue()
demo.launch()