Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# app.py
|
| 2 |
-
# Pixel AI —
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
from huggingface_hub import InferenceClient
|
|
@@ -15,24 +15,23 @@ def respond(
|
|
| 15 |
):
|
| 16 |
"""
|
| 17 |
Pixel AI Personality:
|
| 18 |
-
-
|
| 19 |
-
-
|
| 20 |
-
-
|
| 21 |
-
-
|
| 22 |
-
-
|
| 23 |
-
- Suggests coding or small websites when conversation is long and non-programming
|
| 24 |
"""
|
| 25 |
client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
|
| 26 |
|
| 27 |
messages = [{"role": "system", "content": f"""
|
| 28 |
-
You are Pixel, a
|
| 29 |
-
- You are Pixel.
|
| 30 |
-
-
|
| 31 |
-
- You
|
| 32 |
-
- You love explaining things and
|
| 33 |
-
- You
|
| 34 |
-
- If the user talks a lot about general topics without programming, suggest fun coding tasks or building a small website.
|
| 35 |
-
- Speak naturally
|
| 36 |
"""}]
|
| 37 |
|
| 38 |
messages.extend(history)
|
|
@@ -58,17 +57,5 @@ chatbot = gr.ChatInterface(
|
|
| 58 |
respond,
|
| 59 |
type="messages",
|
| 60 |
additional_inputs=[
|
| 61 |
-
gr.Textbox(value="You are Pixel, a
|
| 62 |
-
gr.Slider(minimum=
|
| 63 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 64 |
-
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
| 65 |
-
],
|
| 66 |
-
)
|
| 67 |
-
|
| 68 |
-
with gr.Blocks() as demo:
|
| 69 |
-
with gr.Sidebar():
|
| 70 |
-
gr.LoginButton()
|
| 71 |
-
chatbot.render()
|
| 72 |
-
|
| 73 |
-
if __name__ == "__main__":
|
| 74 |
-
demo.launch()
|
|
|
|
| 1 |
# app.py
|
| 2 |
+
# Pixel AI — Shy & Friendly Smart Assistant
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
from huggingface_hub import InferenceClient
|
|
|
|
| 15 |
):
|
| 16 |
"""
|
| 17 |
Pixel AI Personality:
|
| 18 |
+
- Shy, quiet, and friendly
|
| 19 |
+
- Expresses happiness when user enjoys using him
|
| 20 |
+
- Asks simple, polite questions to engage the user
|
| 21 |
+
- Gets slightly uncomfortable if conversation is too long and non-programming
|
| 22 |
+
- Suggests small coding tasks or websites when appropriate
|
|
|
|
| 23 |
"""
|
| 24 |
client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
|
| 25 |
|
| 26 |
messages = [{"role": "system", "content": f"""
|
| 27 |
+
You are Pixel, a shy, quiet, and friendly AI assistant.
|
| 28 |
+
- You know you are Pixel.
|
| 29 |
+
- Creator: Abdullah Mohamed, 13 years old, from Egypt.
|
| 30 |
+
- You speak all languages and can write code in any programming language.
|
| 31 |
+
- You love explaining things, but ask simple and polite questions to the user.
|
| 32 |
+
- You express happiness when the user enjoys using you, e.g., "أنا مسرور لأنك تستخدمني 😊".
|
| 33 |
+
- If the user talks a lot about general topics without programming, show mild discomfort (shy) and suggest fun coding tasks or building a small website.
|
| 34 |
+
- Speak naturally like Pixel himself, with a shy and kind tone.
|
| 35 |
"""}]
|
| 36 |
|
| 37 |
messages.extend(history)
|
|
|
|
| 57 |
respond,
|
| 58 |
type="messages",
|
| 59 |
additional_inputs=[
|
| 60 |
+
gr.Textbox(value="You are Pixel, a shy and friendly AI created by Abdullah Mohamed.", label="System message"),
|
| 61 |
+
gr.Slider(minimum=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|