File size: 613 Bytes
3b4210a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()