Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -28,16 +28,16 @@ def predict(message, history, max_tokens, temperature, top_p):
|
|
28 |
# Генерация ответа
|
29 |
outputs = model.generate(
|
30 |
input_ids=inputs,
|
31 |
-
max_new_tokens=
|
32 |
do_sample=True,
|
33 |
-
temperature=
|
34 |
-
top_p=
|
35 |
)
|
36 |
|
37 |
# Декодирование результата
|
38 |
-
response = tokenizer.decode(outputs[0][len(inputs[0]
|
39 |
|
40 |
-
return response.strip()
|
41 |
|
42 |
# Настройка интерфейса Gradio
|
43 |
iface = gr.ChatInterface(
|
|
|
28 |
# Генерация ответа
|
29 |
outputs = model.generate(
|
30 |
input_ids=inputs,
|
31 |
+
max_new_tokens=max_tokens,
|
32 |
do_sample=True,
|
33 |
+
temperature=temperature,
|
34 |
+
top_p=top_p,
|
35 |
)
|
36 |
|
37 |
# Декодирование результата
|
38 |
+
response = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
|
39 |
|
40 |
+
return response.strip().replace("assistant", "", 1)
|
41 |
|
42 |
# Настройка интерфейса Gradio
|
43 |
iface = gr.ChatInterface(
|