File size: 672 Bytes
8cc1f9a
 
fde5a4a
 
 
c647451
fde5a4a
 
 
fef6bc2
fde5a4a
fef6bc2
 
 
 
fde5a4a
7514661
fde5a4a
 
 
 
 
 
 
7514661
94082cb
b1ce122
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr

import torch
from transformers import pipeline

model_id = "deepseek-ai/DeepSeek-R1"
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)

messages = [
    {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
    {"role": "user", "content": "Who are you?"},
]

def model(params):
    outputs = pipe(
    messages,
    max_new_tokens=256,
    )
    output = outputs[0]["generated_text"][-1]
    print(output)
    return output

app = gr.Interface(fn=model, inputs="textbox", outputs="textbox")
app.launch()