Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| MODEL_ID = "mimo-ai/Mimo-V2-Flash" # exact repo name HF par | |
| tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| MODEL_ID, | |
| torch_dtype=torch.float16, | |
| device_map="auto", | |
| trust_remote_code=True | |
| ) | |
| def chat(prompt): | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| output = model.generate( | |
| **inputs, | |
| max_new_tokens=300, | |
| do_sample=True, | |
| temperature=0.7 | |
| ) | |
| return tokenizer.decode(output[0], skip_special_tokens=True) | |
| ui = gr.Interface( | |
| fn=chat, | |
| inputs=gr.Textbox(lines=5, placeholder="Type your message..."), | |
| outputs="text", | |
| title="MIMO V2 Flash – Free HuggingFace Space", | |
| description="Open-source MIMO V2 Flash running on Hugging Face Spaces" | |
| ) | |
| ui.launch() |