Spaces:
Sleeping
Sleeping
fix history
Browse files
app.py
CHANGED
|
@@ -12,11 +12,14 @@ def generate_response(chat, kwargs):
|
|
| 12 |
output += response.token.text
|
| 13 |
return output
|
| 14 |
|
| 15 |
-
def function(prompt):
|
| 16 |
-
chat =
|
|
|
|
|
|
|
|
|
|
| 17 |
kwargs = dict(
|
| 18 |
-
temperature=0.
|
| 19 |
-
max_new_tokens=
|
| 20 |
top_p=0.95,
|
| 21 |
repetition_penalty=1.0,
|
| 22 |
do_sample=True, # Upewnij się, że używasz próbkowania
|
|
@@ -50,4 +53,5 @@ interface = gr.ChatInterface(
|
|
| 50 |
clear_btn=None
|
| 51 |
)
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
| 12 |
output += response.token.text
|
| 13 |
return output
|
| 14 |
|
| 15 |
+
def function(prompt, history=[]): # Tutaj dodajemy history jako opcjonalny parametr
|
| 16 |
+
chat = "<s>"
|
| 17 |
+
for user_prompt, bot_response in history:
|
| 18 |
+
chat += f"[INST] {user_prompt} [/INST] {bot_response}</s> "
|
| 19 |
+
chat += f"[INST] {prompt} [/INST]</s>"
|
| 20 |
kwargs = dict(
|
| 21 |
+
temperature=0.80,
|
| 22 |
+
max_new_tokens=2048,
|
| 23 |
top_p=0.95,
|
| 24 |
repetition_penalty=1.0,
|
| 25 |
do_sample=True, # Upewnij się, że używasz próbkowania
|
|
|
|
| 53 |
clear_btn=None
|
| 54 |
)
|
| 55 |
|
| 56 |
+
# Ustawienie share=True pozwala na stworzenie publicznego linku do aplikacji
|
| 57 |
+
interface.launch(show_api=True, share=True)
|