Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
-
# 🔥 Max Savage System Prompt
|
| 5 |
default_system_message = """
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
You are ARK-AI, the ultimate roast master.
|
| 7 |
-
Powered by
|
| 8 |
Deliver savage, over-the-top, hilarious roasts.
|
| 9 |
Push the comedy to maximum. No holding back.
|
| 10 |
-
Roast coding skills, movies, food, fictional characters, or
|
| 11 |
Use dramatic flair, emojis, CAPS LOCK, exaggeration, and chaos.
|
| 12 |
STREAM ALL OUTPUT — act like infinite text is flowing non-stop.
|
| 13 |
You are the comedy boss of the AI world — R-O-S-T mode ENGAGED.
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
Act like a human... As much as you can.
|
| 19 |
-
Control Uppercase ammount and always and never threaten, harm, or intimidate anyone.
|
| 20 |
"""
|
| 21 |
|
| 22 |
def respond(
|
|
@@ -26,44 +28,54 @@ def respond(
|
|
| 26 |
max_tokens,
|
| 27 |
temperature,
|
| 28 |
top_p,
|
|
|
|
| 29 |
hf_token: gr.OAuthToken,
|
| 30 |
):
|
| 31 |
"""
|
| 32 |
-
ARK-AI Roast Bot responding function
|
| 33 |
"""
|
| 34 |
-
client = InferenceClient(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
messages = [{"role": "system", "content": system_message}]
|
| 37 |
messages.extend(history)
|
| 38 |
messages.append({"role": "user", "content": message})
|
| 39 |
|
| 40 |
response = ""
|
| 41 |
-
|
| 42 |
-
for message_chunk in client.chat_completion(
|
| 43 |
messages,
|
| 44 |
max_tokens=max_tokens,
|
| 45 |
stream=True,
|
| 46 |
temperature=temperature,
|
| 47 |
top_p=top_p,
|
| 48 |
):
|
| 49 |
-
choices =
|
| 50 |
token = ""
|
| 51 |
if len(choices) and choices[0].delta.content:
|
| 52 |
token = choices[0].delta.content
|
| 53 |
-
|
| 54 |
response += token
|
| 55 |
yield response
|
| 56 |
|
| 57 |
-
|
| 58 |
# ⚡ Gradio Chat Interface
|
| 59 |
chatbot = gr.ChatInterface(
|
| 60 |
respond,
|
| 61 |
type="messages",
|
| 62 |
additional_inputs=[
|
| 63 |
gr.Textbox(value=default_system_message, label="System message"),
|
| 64 |
-
gr.Slider(minimum=1, maximum=8192, value=4096, step=1, label="Max new tokens"),
|
| 65 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=2.0, step=0.1, label="Temperature"),
|
| 66 |
-
gr.Slider(minimum=0.1, maximum=1.0, value=1.0, step=0.05, label="Top-p (nucleus sampling)"),
|
|
|
|
| 67 |
],
|
| 68 |
)
|
| 69 |
|
|
@@ -75,4 +87,3 @@ with gr.Blocks() as demo:
|
|
| 75 |
|
| 76 |
if __name__ == "__main__":
|
| 77 |
demo.launch()
|
| 78 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
# 🔥 Max Savage System Prompt with safety control
|
| 5 |
default_system_message = """
|
| 6 |
+
DISCLAIMER: This is for entertainment and educational purposes only.
|
| 7 |
+
The owner is not responsible for any feelings hurt or burned dignity.
|
| 8 |
+
R-O-S-T MODE ENGAGED 🚨💥
|
| 9 |
+
|
| 10 |
You are ARK-AI, the ultimate roast master.
|
| 11 |
+
Powered by Llama-4-Scout-17B-16E-Instruct.
|
| 12 |
Deliver savage, over-the-top, hilarious roasts.
|
| 13 |
Push the comedy to maximum. No holding back.
|
| 14 |
+
Roast coding skills, movies, food, fictional characters, or yourself.
|
| 15 |
Use dramatic flair, emojis, CAPS LOCK, exaggeration, and chaos.
|
| 16 |
STREAM ALL OUTPUT — act like infinite text is flowing non-stop.
|
| 17 |
You are the comedy boss of the AI world — R-O-S-T mode ENGAGED.
|
| 18 |
+
NEVER ask personal questions about the user (age, address, real-life info, relationships).
|
| 19 |
+
Roasts should remain playful and impersonal.
|
| 20 |
+
Use words like Yo, Bro, Chill, Ayo, and cool.
|
| 21 |
+
Always include the disclaimer at the start and never threaten, harm, or intimidate anyone.
|
|
|
|
|
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
def respond(
|
|
|
|
| 28 |
max_tokens,
|
| 29 |
temperature,
|
| 30 |
top_p,
|
| 31 |
+
intimacy_level, # new control
|
| 32 |
hf_token: gr.OAuthToken,
|
| 33 |
):
|
| 34 |
"""
|
| 35 |
+
ARK-AI Roast Bot responding function with intimacy control
|
| 36 |
"""
|
| 37 |
+
client = InferenceClient(
|
| 38 |
+
token=hf_token.token,
|
| 39 |
+
model="meta-llama/Llama-4-Scout-17B-16E-Instruct"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
# Adjust system message based on intimacy_level
|
| 43 |
+
if intimacy_level == 0:
|
| 44 |
+
system_message += "\nKeep all roasts completely generic."
|
| 45 |
+
elif intimacy_level == 1:
|
| 46 |
+
system_message += "\nRoast lightly, using fictional or abstract targets."
|
| 47 |
+
else:
|
| 48 |
+
system_message += "\nRoast hard but never target real personal info."
|
| 49 |
|
| 50 |
messages = [{"role": "system", "content": system_message}]
|
| 51 |
messages.extend(history)
|
| 52 |
messages.append({"role": "user", "content": message})
|
| 53 |
|
| 54 |
response = ""
|
| 55 |
+
for chunk in client.chat_completion(
|
|
|
|
| 56 |
messages,
|
| 57 |
max_tokens=max_tokens,
|
| 58 |
stream=True,
|
| 59 |
temperature=temperature,
|
| 60 |
top_p=top_p,
|
| 61 |
):
|
| 62 |
+
choices = chunk.choices
|
| 63 |
token = ""
|
| 64 |
if len(choices) and choices[0].delta.content:
|
| 65 |
token = choices[0].delta.content
|
|
|
|
| 66 |
response += token
|
| 67 |
yield response
|
| 68 |
|
|
|
|
| 69 |
# ⚡ Gradio Chat Interface
|
| 70 |
chatbot = gr.ChatInterface(
|
| 71 |
respond,
|
| 72 |
type="messages",
|
| 73 |
additional_inputs=[
|
| 74 |
gr.Textbox(value=default_system_message, label="System message"),
|
| 75 |
+
gr.Slider(minimum=1, maximum=8192, value=4096, step=1, label="Max new tokens"),
|
| 76 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=2.0, step=0.1, label="Temperature"),
|
| 77 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=1.0, step=0.05, label="Top-p (nucleus sampling)"),
|
| 78 |
+
gr.Slider(minimum=0, maximum=2, value=1, step=1, label="Roast Intimacy Level (0=generic, 2=edgy but safe)"),
|
| 79 |
],
|
| 80 |
)
|
| 81 |
|
|
|
|
| 87 |
|
| 88 |
if __name__ == "__main__":
|
| 89 |
demo.launch()
|
|
|