Spaces:
Runtime error
Runtime error
File size: 447 Bytes
547d16a da47371 547d16a da47371 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import torch # <-- Add this line
import gradio as gr
from transformers import pipeline
pipe = pipeline(
"text-generation",
model="agentica-org/DeepCoder-14B-Preview",
device="cuda" if torch.cuda.is_available() else "cpu" # Now torch is defined
)
def chat(message, history):
messages = [{"role": "user", "content": message}]
response = pipe(messages)
return response[0]["generated_text"]
gr.ChatInterface(chat).launch() |