Spaces:
Runtime error
Runtime error
vericudebuget
commited on
Commit
•
96df08a
1
Parent(s):
d58733f
Update app.py
Browse files
app.py
CHANGED
@@ -32,10 +32,14 @@ def generate(prompt, history, temperature=0.9, max_new_tokens=9048, top_p=0.95,
|
|
32 |
|
33 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
34 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
|
|
35 |
output = ""
|
36 |
for response in stream:
|
37 |
output += response.token.text
|
38 |
-
|
|
|
|
|
|
|
39 |
|
40 |
additional_inputs = [
|
41 |
gr.Slider(label="Temperature", value=0.9, minimum=0.0, maximum=1.0, step=0.05, interactive=True, info="Higher values produce more diverse outputs"),
|
@@ -47,7 +51,7 @@ additional_inputs = [
|
|
47 |
avatar_images = ("https://i.postimg.cc/pXjKKVXG/user-circle.png", "https://i.postimg.cc/qq04Yz93/CL3.png")
|
48 |
|
49 |
gr.ChatInterface(
|
50 |
-
fn=
|
51 |
chatbot=gr.Chatbot(show_label=True, show_share_button=False, show_copy_button=True, likeable=True, layout="panel", height="auto", avatar_images=avatar_images),
|
52 |
additional_inputs=additional_inputs,
|
53 |
title="ConvoLite",
|
|
|
32 |
|
33 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
34 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
35 |
+
|
36 |
output = ""
|
37 |
for response in stream:
|
38 |
output += response.token.text
|
39 |
+
yield output
|
40 |
+
|
41 |
+
def chat(prompt, history, temperature, max_new_tokens, top_p, repetition_penalty):
|
42 |
+
return generate(prompt, history, temperature, max_new_tokens, top_p, repetition_penalty)
|
43 |
|
44 |
additional_inputs = [
|
45 |
gr.Slider(label="Temperature", value=0.9, minimum=0.0, maximum=1.0, step=0.05, interactive=True, info="Higher values produce more diverse outputs"),
|
|
|
51 |
avatar_images = ("https://i.postimg.cc/pXjKKVXG/user-circle.png", "https://i.postimg.cc/qq04Yz93/CL3.png")
|
52 |
|
53 |
gr.ChatInterface(
|
54 |
+
fn=chat,
|
55 |
chatbot=gr.Chatbot(show_label=True, show_share_button=False, show_copy_button=True, likeable=True, layout="panel", height="auto", avatar_images=avatar_images),
|
56 |
additional_inputs=additional_inputs,
|
57 |
title="ConvoLite",
|