braindeck commited on
Commit ·
679a158
1
Parent(s): a73f45a
Add @spaces.GPU decorator
Browse files12345678910118 unmodified lines2021222324252612 unmodified lines39404142import gradio as grfrom transformers import AutoTokenizer, AutoModelForCausalLMimport torch# 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")def 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("Enter a prompt and the model will generate a response.")with gr.Row():12 unmodified lines)if __name__ == "__main__":demo.launch()123456789101112138 unmodified lines2223242526272812 unmodified lines41424344import 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("# 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()
app.py+4-2