braindeck commited on
Commit ·
679a158
1
Parent(s): a73f45a
Add @spaces.GPU decorator
Browse files123456789101112138 unmodified lines222324232526272812 unmodified lines4142434244import gradio as grfrom transformers import AutoTokenizer, AutoModelForCausalLMimport torchimport spaces
# Load the model and tokenizertokenizer = AutoTokenizer.from_pretrained("braindeck/text2text", trust_remote_code=True, subfolder="checkpoints/model")model = AutoModelForCausalLM.from_pretrained("braindeck/text2text", trust_remote_code=True, torch_dtype=torch.bfloat16, device_map="auto", subfolder="checkpoints/model")
@spaces.GPUdef generate_response(prompt): """ Generates a response from the model.8 unmodified lines
# Create the Gradio interfacewith gr.Blocks() as demo: gr.Markdown("# Text-to-Text Generation with DeepSeek-R1-Distill-Qwen-7B") gr.Markdown("# Fine-tuned Text-to-Text Generation") gr.Markdown("Enter a prompt and the model will generate a response.") with gr.Row():12 unmodified lines )
if __name__ == "__main__": demo.launch() demo.launch()app.py+4-2