Commit ·
35a604c
1
Parent(s): b06c379
Update app.py with new model
Browse files1234567891011121314 unmodified lines28293031323334353637import torchfrom transformers import AutoTokenizerfrom transformers import AutoModelForCausalLMimport gradio as gr# Load LLaMA tokenizer (base tokenizer)tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")# Load your CSM-1B model (must support causal LM interface)model = AutoModelForCausalLM.from_pretrained("BWComedian/CSM-1B", trust_remote_code=True)device = torch.device("cuda" if torch.cuda.is_available() else "cpu")model.to(device)14 unmodified linesdemo = gr.Interface(fn=generate_response,inputs=gr.Textbox(lines=5, placeholder="Talk to Maya..."),outputs=gr.Textbox(label="Maya says", lines=10),title="CSM-1B Maya Chatbot",description="Chat with your Maya-like model.")if __name__ == "__main__":12345678914 unmodified lines24252627282930313233from transformers import AutoTokenizer, AutoModelForCausalLMimport torchimport gradio as grtokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf")device = torch.device("cuda" if torch.cuda.is_available() else "cpu")model.to(device)14 unmodified linesdemo = gr.Interface(fn=generate_response,inputs=gr.Textbox(lines=5, placeholder="Talk to the model..."),outputs=gr.Textbox(label="Response", lines=10),title="Chat with Llama 2 7B",description="Open-access LLM demo.")if __name__ == "__main__":
app.py+7-11