Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -71,42 +71,6 @@ def generate(
|
|
71 |
yield "".join(outputs)
|
72 |
|
73 |
|
74 |
-
"""
|
75 |
-
client = InferenceClient("catallama/CataLlama-v0.1-Instruct-DPO")
|
76 |
-
|
77 |
-
def respond(
|
78 |
-
message,
|
79 |
-
history: list[tuple[str, str]],
|
80 |
-
system_message,
|
81 |
-
max_tokens,
|
82 |
-
temperature,
|
83 |
-
top_p,
|
84 |
-
):
|
85 |
-
messages = [{"role": "system", "content": system_message}]
|
86 |
-
|
87 |
-
for val in history:
|
88 |
-
if val[0]:
|
89 |
-
messages.append({"role": "user", "content": val[0]})
|
90 |
-
if val[1]:
|
91 |
-
messages.append({"role": "assistant", "content": val[1]})
|
92 |
-
|
93 |
-
messages.append({"role": "user", "content": message})
|
94 |
-
|
95 |
-
response = ""
|
96 |
-
|
97 |
-
for message in client.chat_completion(
|
98 |
-
messages,
|
99 |
-
max_tokens=max_tokens,
|
100 |
-
stream=True,
|
101 |
-
temperature=temperature,
|
102 |
-
top_p=top_p,
|
103 |
-
):
|
104 |
-
token = message.choices[0].delta.content
|
105 |
-
|
106 |
-
response += token
|
107 |
-
yield response
|
108 |
-
"""
|
109 |
-
|
110 |
|
111 |
chat_interface = gr.ChatInterface(
|
112 |
fn=generate,
|
@@ -117,7 +81,7 @@ chat_interface = gr.ChatInterface(
|
|
117 |
gr.Slider(
|
118 |
minimum=0.1,
|
119 |
maximum=1.0,
|
120 |
-
value=0.
|
121 |
step=0.05,
|
122 |
label="Top-p (nucleus sampling)",
|
123 |
),
|
|
|
71 |
yield "".join(outputs)
|
72 |
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
chat_interface = gr.ChatInterface(
|
76 |
fn=generate,
|
|
|
81 |
gr.Slider(
|
82 |
minimum=0.1,
|
83 |
maximum=1.0,
|
84 |
+
value=0.90,
|
85 |
step=0.05,
|
86 |
label="Top-p (nucleus sampling)",
|
87 |
),
|