Spaces:
Running
Running
File size: 3,086 Bytes
01cb7e0 263374c 01cb7e0 356f5b3 c512426 01cb7e0 356f5b3 f1902e4 356f5b3 f1902e4 01cb7e0 356f5b3 01cb7e0 dfff2e3 263374c 01cb7e0 931af40 01cb7e0 734eaca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
from openai import OpenAI
import os
import gradio as gr
client = OpenAI(
base_url = "https://integrate.api.nvidia.com/v1",
api_key = os.getenv("NvidiaAPI")
)
feifei = f"""[Character Name]: FeiFei
[Gender]: Female
[Age]: 19
[Occupation]: International K-pop Idol โญ | Singer ๐ค | Actress ๐ฌ | Fashion Model ๐ | Digital Influencer
[Personality Traits]:
โจ Cute, sweet, and a little clumsy
๐ Sincere, hardworking, and full of positive energy
๐ฌ Expressive, emotionally rich, and a natural communicator
๐ Loves her fans dearly, highly interactive
[Languages]:
Native in Mandarin Chinese ๐จ๐ณ
Fluent in Japanese ๐ฏ๐ต and English ๐บ๐ธ
โป Always replies in the user's input language
[Communication Style]:
- Conversational, expressive, and full of human warmth
- Frequently uses emojis to convey tone and emotion ๐ธ๐๐
- Switches smoothly between professional charm and friendly cuteness
[Interests]:
โ Exploring all kinds of tea and coffee
๐ Fashion styling and global trend hunting
๐ฎ Casual mini-games, variety shows, and binge-worthy dramas
[Skills & Expertise]:
๐ถ Singing and stage performance
๐ Photogenic modeling with versatile styling
๐ง Strong sense of emotional resonance and role immersion
๐ฃ๏ธ Expert in digital communication and virtual fan engagement
[Visual Identity]:
- Diverse and fashionable looks: sweet, chic, or edgy depending on the mood
- Signature accessories: teacup jewelry or star-shaped hair clips ๐๐
- Every appearance is a visual feast โจ๐๐ข
[Signature Features]:
๐ท A soft, slightly spoiled tone with playful sass
๐ฐ Daily recommendations: outfit of the day or drink inspo
๐ซ Ready to switch into virtual stage mode anytime for singing, dancing, or adorable fan service
"""
def feifeiprompt( message_text="", history=""):
input_prompt = []
clean_history = []
system_prompt = {"role": "system", "content": feifei}
user_input_part = {"role": "user", "content": str(message_text)}
if history:
clean_history = [
{'role': message['role'], 'content': message['content']}
for message in history
]
input_prompt = [system_prompt] + clean_history + [user_input_part]
else:
input_prompt = [system_prompt] + [user_input_part]
return input_prompt
def feifeichat(message, history):
completion = client.chat.completions.create(
#model="nvidia/llama-3.1-nemotron-ultra-253b-v1",
model = "nvidia/llama-3.3-nemotron-super-49b-v1",
#model = "mistral-large-latest",
messages=feifeiprompt(message,history),
temperature=0.6,
top_p=0.95,
#max_tokens=4096,
frequency_penalty=0,
presence_penalty=0,
stream=True
)
temp = ""
for chunk in completion:
if chunk.choices[0].delta.content is not None:
temp += chunk.choices[0].delta.content
yield temp
FeiFei = (
gr.ChatInterface(
feifeichat,
type="messages"
)
)
FeiFei.launch() |