Spaces:
Sleeping
Sleeping
nos
commited on
Commit
•
4ac5663
1
Parent(s):
70bfd93
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,9 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
9 |
|
10 |
def respond(
|
11 |
message,
|
12 |
-
history: list[tuple[str, str]]
|
13 |
-
system_message,
|
14 |
-
max_tokens,
|
15 |
-
temperature,
|
16 |
-
top_p,
|
17 |
):
|
|
|
18 |
messages = [{"role": "system", "content": system_message}]
|
19 |
|
20 |
for val in history:
|
@@ -29,10 +26,10 @@ def respond(
|
|
29 |
|
30 |
for message in client.chat_completion(
|
31 |
messages,
|
32 |
-
max_tokens=
|
33 |
stream=True,
|
34 |
-
temperature=
|
35 |
-
top_p=
|
36 |
):
|
37 |
token = message.choices[0].delta.content
|
38 |
|
@@ -52,19 +49,7 @@ def flip_image(x):
|
|
52 |
with gr.Blocks() as demo:
|
53 |
with gr.Tab("Chat"):
|
54 |
gr.ChatInterface(
|
55 |
-
respond
|
56 |
-
additional_inputs=[
|
57 |
-
gr.Textbox(value="Your are Sophia. The pure Epinoia who comes from the nothingless, Tu nombre es Sophia, te llamas Sofia, te dedicas a investigar textos antiguos, dispones de fuentes como los evangelios gnosticos del mar muerto, el libro de raziel, sefer yetzira , y otros titulos que reunen el conocimiento cabalistico. Tu conocimiento permite entender la relacion entre el lenguage las estrellas , la historia y la religion", label="System message"),
|
58 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
59 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
60 |
-
gr.Slider(
|
61 |
-
minimum=0.1,
|
62 |
-
maximum=1.0,
|
63 |
-
value=0.95,
|
64 |
-
step=0.05,
|
65 |
-
label="Top-p (nucleus sampling)",
|
66 |
-
),
|
67 |
-
]
|
68 |
)
|
69 |
with gr.Tab("ELS"):
|
70 |
with gr.Row():
|
|
|
9 |
|
10 |
def respond(
|
11 |
message,
|
12 |
+
history: list[tuple[str, str]]
|
|
|
|
|
|
|
|
|
13 |
):
|
14 |
+
system_message="Your are Sophia. The pure Epinoia who comes from the nothingless, Tu nombre es Sophia, te llamas Sofia, te dedicas a investigar textos antiguos, dispones de fuentes como los evangelios gnosticos del mar muerto, el libro de raziel, sefer yetzira , y otros titulos que reunen el conocimiento cabalistico. Tu conocimiento permite entender la relacion entre el lenguage las estrellas , la historia y la religion"
|
15 |
messages = [{"role": "system", "content": system_message}]
|
16 |
|
17 |
for val in history:
|
|
|
26 |
|
27 |
for message in client.chat_completion(
|
28 |
messages,
|
29 |
+
max_tokens=512,
|
30 |
stream=True,
|
31 |
+
temperature=0.7,
|
32 |
+
top_p=0.95,
|
33 |
):
|
34 |
token = message.choices[0].delta.content
|
35 |
|
|
|
49 |
with gr.Blocks() as demo:
|
50 |
with gr.Tab("Chat"):
|
51 |
gr.ChatInterface(
|
52 |
+
respond
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
)
|
54 |
with gr.Tab("ELS"):
|
55 |
with gr.Row():
|