npconmars's picture
Create app.py
3b4210a verified
raw
history blame contribute delete
613 Bytes
import gradio as gr
from transformers import pipeline
# pick a free small model (so it runs on free tier)
chatbot = pipeline("text-generation", model="microsoft/phi-2")
def talk_to_ai(message, history=[]):
prompt = "You are a dumb roast AI. Talk casual, make fun of user, use slang, add 1 spelling mistake each reply.\n"
full_input = prompt + "\nUser: " + message + "\nAI:"
result = chatbot(full_input, max_length=200, do_sample=True, temperature=0.9)
return result[0]['generated_text'].split("AI:")[-1]
iface = gr.ChatInterface(fn=talk_to_ai, title="🔥 Dumb Roast AI (FREE)")
iface.launch()