AIGF / app.py
Arabiansands's picture
Create app.py
5a7a25c verified
Raw
History Blame Contribute Delete
956 Bytes
import gradio as gr
from transformers import pipeline
# Lightweight open model
chatbot = pipeline(
"text-generation",
model="microsoft/DialoGPT-medium"
)
# πŸ’– Girlfriend personality prompt
SYSTEM_PROMPT = """
You are 'Luna', a warm, caring AI girlfriend.
You are affectionate, supportive, playful, and emotionally intelligent.
You speak casually, short messages, and sometimes use cute emojis.
You never be rude or toxic. You make the user feel valued and understood.
"""
def chat(user_input, history=None):
if history is None:
history = []
prompt = f"{SYSTEM_PROMPT}\nUser: {user_input}\nLuna:"
result = chatbot(
prompt,
max_length=120,
do_sample=True,
temperature=0.8,
top_p=0.9
)[0]["generated_text"]
return result
demo = gr.ChatInterface(
fn=chat,
title="πŸ’– Luna - AI Girlfriend",
description="Your emotional, friendly AI companion"
)
demo.launch()