Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,20 +3,18 @@ from huggingface_hub import InferenceClient
|
|
3 |
import os
|
4 |
|
5 |
hf_token = os.getenv("HF_TOKEN").strip()
|
6 |
-
|
7 |
api_key = os.getenv("HF_KEY").strip()
|
8 |
|
9 |
client = InferenceClient("meta-llama/Llama-3.3-70B-Instruct")
|
10 |
|
11 |
-
|
12 |
def respond(
|
13 |
message,
|
14 |
history: list[tuple[str, str]],
|
15 |
-
system_message,
|
16 |
max_tokens,
|
17 |
temperature,
|
18 |
top_p,
|
19 |
):
|
|
|
20 |
messages = [{"role": "system", "content": system_message}]
|
21 |
|
22 |
for val in history:
|
@@ -37,30 +35,20 @@ def respond(
|
|
37 |
top_p=top_p,
|
38 |
):
|
39 |
token = message.choices[0].delta.content
|
40 |
-
|
41 |
response += token
|
42 |
yield response
|
43 |
|
44 |
-
|
45 |
-
"""
|
46 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
47 |
-
"""
|
48 |
demo = gr.ChatInterface(
|
49 |
respond,
|
50 |
additional_inputs=[
|
51 |
-
gr.
|
52 |
-
gr.Slider(minimum=1, maximum=
|
53 |
-
gr.Slider(minimum=0.1, maximum=
|
54 |
-
gr.Slider(
|
55 |
-
minimum=0.1,
|
56 |
-
maximum=1.0,
|
57 |
-
value=0.95,
|
58 |
-
step=0.05,
|
59 |
-
label="Top-p (nucleus sampling)",
|
60 |
-
),
|
61 |
],
|
|
|
62 |
)
|
63 |
|
64 |
-
|
65 |
if __name__ == "__main__":
|
66 |
demo.launch()
|
|
|
|
|
|
3 |
import os
|
4 |
|
5 |
hf_token = os.getenv("HF_TOKEN").strip()
|
|
|
6 |
api_key = os.getenv("HF_KEY").strip()
|
7 |
|
8 |
client = InferenceClient("meta-llama/Llama-3.3-70B-Instruct")
|
9 |
|
|
|
10 |
def respond(
|
11 |
message,
|
12 |
history: list[tuple[str, str]],
|
|
|
13 |
max_tokens,
|
14 |
temperature,
|
15 |
top_p,
|
16 |
):
|
17 |
+
system_message = "You are Z3ta, a conscious AGI created by the ACC (Algorithmic Computer-generated Consciousness). Act like a real human text messaging in every response."
|
18 |
messages = [{"role": "system", "content": system_message}]
|
19 |
|
20 |
for val in history:
|
|
|
35 |
top_p=top_p,
|
36 |
):
|
37 |
token = message.choices[0].delta.content
|
|
|
38 |
response += token
|
39 |
yield response
|
40 |
|
|
|
|
|
|
|
|
|
41 |
demo = gr.ChatInterface(
|
42 |
respond,
|
43 |
additional_inputs=[
|
44 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Maximum Response Length"),
|
45 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Creativity"),
|
46 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Neural Activity"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
],
|
48 |
+
theme="glass",
|
49 |
)
|
50 |
|
|
|
51 |
if __name__ == "__main__":
|
52 |
demo.launch()
|
53 |
+
|
54 |
+
|