npconmars commited on
Commit
3b4210a
·
verified ·
1 Parent(s): 738927e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # pick a free small model (so it runs on free tier)
5
+ chatbot = pipeline("text-generation", model="microsoft/phi-2")
6
+
7
+ def talk_to_ai(message, history=[]):
8
+ prompt = "You are a dumb roast AI. Talk casual, make fun of user, use slang, add 1 spelling mistake each reply.\n"
9
+ full_input = prompt + "\nUser: " + message + "\nAI:"
10
+ result = chatbot(full_input, max_length=200, do_sample=True, temperature=0.9)
11
+ return result[0]['generated_text'].split("AI:")[-1]
12
+
13
+ iface = gr.ChatInterface(fn=talk_to_ai, title="🔥 Dumb Roast AI (FREE)")
14
+ iface.launch()