from transformers import AutoTokenizer, AutoModelForSeq2SeqLM import gradio as gr model_id = "google/flan-t5-small" # Extremely fast and CPU-friendly tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForSeq2SeqLM.from_pretrained(model_id) system_prompt = "You are 𝕴 𝖆𝖒 𝖍𝖎𝖒 — a fun, fast, emotionally tuned AI chatbot created by 𝕴 𝖆𝖒 𝖍𝖎𝖒. You reply quickly, like a chill and clever human friend." def chat(history, message): prompt = f"{system_prompt}\nUser: {message}\nAI:" inputs = tokenizer(prompt, return_tensors="pt") outputs = model.generate(**inputs, max_new_tokens=100) reply = tokenizer.decode(outputs[0], skip_special_tokens=True).strip() history = history or [] history.append((message, reply)) return history, history iface = gr.Interface( fn=chat, inputs=[gr.State(), gr.Textbox(placeholder="Talk to 𝕴 𝖆𝖒 𝖍𝖎𝖒...")], outputs=[gr.State(), gr.Chatbot(label="𝕴 𝖆𝖒 𝖍𝖎𝖒 AI Chatbot")], title="𝕴 𝖆𝖒 𝖍𝖎𝖒 — Superfast Chatbot", description="An extremely fast and chill AI chatbot, created by 𝕴 𝖆𝖒 𝖍𝖎𝖒. Running on Hugging Face Spaces (CPU only).", allow_flagging="never" ) iface.launch()