Spaces:
Running on Zero
Running on Zero
File size: 421 Bytes
1f6e504 af4ba2c 1f6e504 af4ba2c 1f6e504 af4ba2c 1f6e504 5cc33d1 1f6e504 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import gradio as gr
from transformers import pipeline
import spaces
pipe = pipeline(
"text-generation", model="Spreadsheet-RL/Spreadsheet-RL-4B", device="cuda"
)
@spaces.GPU
def generate(prompt):
messages = [
{"role": "user", "content": prompt},
]
return pipe(messages, max_new_tokens=40)[0]["generated_text"][-1]["content"]
gr.Interface(fn=generate, inputs="text", outputs="text").launch()
|