Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def user(user_message, history):
|
|
41 |
return "", history + [[user_message, None]]
|
42 |
|
43 |
#Chat KI nutzen, um Text zu generieren...
|
44 |
-
def bot(history):
|
45 |
# generation parameter
|
46 |
gen_kwargs = dict(
|
47 |
max_new_tokens=512,
|
@@ -51,7 +51,7 @@ def bot(history):
|
|
51 |
repetition_penalty=1.02,
|
52 |
stop_sequences=["\nUser:", "<|endoftext|>", "</s>"],
|
53 |
)
|
54 |
-
prompt = generate_prompt_with_history(
|
55 |
stream = client.text_generation(prompt, stream=True, details=True, **gen_kwargs)
|
56 |
|
57 |
history[-1][1] = ""
|
@@ -89,7 +89,7 @@ with gr.Blocks() as demo:
|
|
89 |
|
90 |
|
91 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
92 |
-
bot, chatbot, chatbot
|
93 |
)
|
94 |
clear.click(lambda: None, None, chatbot, queue=False)
|
95 |
|
|
|
41 |
return "", history + [[user_message, None]]
|
42 |
|
43 |
#Chat KI nutzen, um Text zu generieren...
|
44 |
+
def bot(user_message, history):
|
45 |
# generation parameter
|
46 |
gen_kwargs = dict(
|
47 |
max_new_tokens=512,
|
|
|
51 |
repetition_penalty=1.02,
|
52 |
stop_sequences=["\nUser:", "<|endoftext|>", "</s>"],
|
53 |
)
|
54 |
+
prompt = generate_prompt_with_history(user_message,history)
|
55 |
stream = client.text_generation(prompt, stream=True, details=True, **gen_kwargs)
|
56 |
|
57 |
history[-1][1] = ""
|
|
|
89 |
|
90 |
|
91 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
92 |
+
bot, [msg, chatbot], chatbot
|
93 |
)
|
94 |
clear.click(lambda: None, None, chatbot, queue=False)
|
95 |
|