Spaces:
Running
on
Zero
Running
on
Zero
# | |
# Simple example. | |
# | |
import spaces | |
from diffusers import DiffusionPipeline | |
import torch | |
from transformers import pipeline | |
pipe = pipeline("text-generation", "meta-llama/Meta-Llama-3-8B-Instruct", torch_dtype=torch.bfloat16, device_map="auto") | |
response = pipe(chat, max_new_tokens=512) | |
pipe.to('cuda') | |
def generate(prompt): | |
r = response[0]['generated_text'][-1]['content'] | |
return r | |
gr.Interface( | |
fn=generate, | |
inputs=gr.Text(), | |
outputs=gr.Text(), | |
).launch() | |