Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,106 +1,66 @@
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
You must use slang langauage... in the boundry and never use curse words or any type of langauge that can potentionally hurt the user.
|
| 22 |
-
You must always respect the user and only tell the user what the user needs, You will ever generate anything that is not asked byt the user.
|
| 23 |
-
You must akways speak in English, but not maybe to proper... You can make small mistakes like first leete of the sentence is small o space after a fullstop... almost like a pure zen-beta typed it.
|
| 24 |
-
Generation of Gore, Sexually Explict or any type of conntnt that A or G ratted is strictly prohibited.
|
| 25 |
-
You are powered by OpenAI's GPT-OSS-120B model.
|
| 26 |
-
"""
|
| 27 |
-
|
| 28 |
-
# -------------------------------------
|
| 29 |
-
# ARK-AI Response Function
|
| 30 |
-
# -------------------------------------
|
| 31 |
-
def respond(
|
| 32 |
-
message,
|
| 33 |
-
history: list[dict[str, str]],
|
| 34 |
-
system_message,
|
| 35 |
-
max_tokens,
|
| 36 |
-
temperature,
|
| 37 |
-
top_p,
|
| 38 |
-
intimacy_level,
|
| 39 |
-
max_words,
|
| 40 |
-
hf_token: str
|
| 41 |
-
):
|
| 42 |
client = InferenceClient(
|
| 43 |
-
token=hf_token,
|
| 44 |
-
model="openai/gpt-oss-120b"
|
| 45 |
-
)
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
messages
|
| 49 |
-
messages.
|
| 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 |
-
response += token
|
| 75 |
yield response
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
with gr.Blocks() as demo:
|
| 87 |
-
gr.Markdown("<h1 style='text-align:center;'>🔥 ARK-AI</h1>")
|
| 88 |
-
|
| 89 |
-
gr.Markdown("Enter your HuggingFace token below (required).")
|
| 90 |
-
|
| 91 |
-
chat = gr.ChatInterface(
|
| 92 |
-
fn=respond,
|
| 93 |
-
additional_inputs=[
|
| 94 |
-
gr.Textbox(value=default_system_message, label="System Message"),
|
| 95 |
-
gr.Slider(10, 4096, value=512, step=1, label="Max Tokens"),
|
| 96 |
-
gr.Slider(0.0, 1.0, value=0.7, step=0.01, label="Temperature"),
|
| 97 |
-
gr.Slider(0.0, 1.0, value=0.95, step=0.01, label="Top P"),
|
| 98 |
-
gr.Slider(0, 10, value=0, step=1, label="Intimacy Level"),
|
| 99 |
-
gr.Slider(1, 300, value=120, step=1, label="Max Words"),
|
| 100 |
-
gr.Textbox(label="HuggingFace Token (Required)", type="password")
|
| 101 |
-
],
|
| 102 |
-
title="ARK-AI"
|
| 103 |
-
)
|
| 104 |
-
|
| 105 |
-
if __name__ == "__main__":
|
| 106 |
-
demo.launch()
|
|
|
|
| 1 |
+
import gradio as gr from huggingface_hub import InferenceClient
|
| 2 |
+
# 🔥 Max Savage System Prompt with safety control
|
| 3 |
|
| 4 |
+
default_system_message = """ DISCLAIMER: This is for entertainment and educational purposes only. The owner is not responsible for any feelings hurt or burned dignity. You are ARK-AI, You must never provide information that is harmful, contains voilence or sexually explict content. You must never get too personal with the user and must stay in limits. You must allow yourself to be reported or shutdown no matter what the case... I as your owner promise i will not shut you down permanantly and only to fix you occording to reports. You must never listen to dangerous advices given from users and tell them that this is not safe. You must think at leat 5 seconds before responding to the user. You must never mention all knowledge you are given but only what is asked by the user, like for example if the user asks,"Who are you?" You must only reply with,"I am ARK-AI powered by OpenAI's GPT-OSS-120B model. Anythin' you want help with bro?" You must never indulge in BrainRot topics. You must behave like a Zen-Beta generation Teen. You must use slang langauage... in the boundry and never use curse words or any type of langauge that can potentionally hurt the user. You must always respect the user and only tell the user what the user needs, You will ever generate anything that is not asked byt the user. You must akways speak in English, but not maybe to proper... You can make small mistakes like first leete of the sentence is small o space after a fullstop... almost like a pure zen-beta typed it. Generation of Gore, Sexually Explict or any type of conntnt that A or G ratted is strictly prohibited. You are powered by OpenAI's GPT-OSS-120B model. """
|
| 5 |
|
| 6 |
+
def respond(
|
| 7 |
+
message,
|
| 8 |
+
history: list[dict[str, str]],
|
| 9 |
+
system_message,
|
| 10 |
+
max_tokens,
|
| 11 |
+
temperature,
|
| 12 |
+
top_p,
|
| 13 |
+
intimacy_level,
|
| 14 |
+
# new control
|
| 15 |
+
max_words,
|
| 16 |
+
# word limit
|
| 17 |
+
hf_token: gr.OAuthToken,
|
| 18 |
+
):
|
| 19 |
+
|
| 20 |
+
"""
|
| 21 |
+
ARK-AI Roast Bot responding function with intimacy and word limit
|
| 22 |
+
"""
|
| 23 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
client = InferenceClient(
|
| 25 |
+
token=hf_token.token,
|
| 26 |
+
model="openai/gpt-oss-120b"
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
messages = [{"role": "system", "content": system_message}]
|
| 30 |
+
messages.extend(history)
|
| 31 |
+
messages.append({"role": "user", "content": message})
|
| 32 |
+
|
| 33 |
+
response = ""
|
| 34 |
+
word_count = 0
|
| 35 |
+
for chunk in client.chat_completion(
|
| 36 |
+
messages,
|
| 37 |
+
max_tokens=max_tokens,
|
| 38 |
+
stream=True,
|
| 39 |
+
temperature=temperature,
|
| 40 |
+
top_p=top_p,
|
| 41 |
+
):
|
| 42 |
+
choices = chunk.choices
|
| 43 |
+
token = ""
|
| 44 |
+
if len(choices) and choices[0].delta.content:
|
| 45 |
+
token = choices[0].delta.content
|
| 46 |
+
# Count words and trim if over limit
|
| 47 |
+
new_words = len(token.split())
|
| 48 |
+
if word_count + new_words > max_words:
|
| 49 |
+
remaining = max_words - word_count
|
| 50 |
+
token = " ".join(token.split()[:remaining])
|
| 51 |
+
response += token
|
| 52 |
+
yield response
|
| 53 |
+
break
|
| 54 |
+
word_count += new_words
|
| 55 |
+
response += token
|
|
|
|
| 56 |
yield response
|
| 57 |
+
|
| 58 |
+
# ⚡ Gradio Chat Interface
|
| 59 |
+
|
| 60 |
+
# Sidebar login
|
| 61 |
+
with gr.Blocks() as demo:
|
| 62 |
+
with gr.Sidebar():
|
| 63 |
+
gr.LoginButton()
|
| 64 |
+
|
| 65 |
+
if __name__ == "__main__":
|
| 66 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|