Spaces:
Runtime error
Runtime error
Commit
·
f398823
1
Parent(s):
8c89a95
Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,8 @@ def format_prompt(message, history):
|
|
12 |
prompt += f"[INST] {message} [/INST]"
|
13 |
return prompt
|
14 |
|
15 |
-
def generate(prompt,history):
|
16 |
-
seed = random.randint(1,9999999999999)
|
17 |
|
18 |
system_prompt = prompts.SONG_WRITER
|
19 |
generate_kwargs = dict(
|
@@ -33,6 +33,26 @@ def generate(prompt,history):
|
|
33 |
output += response.token.text
|
34 |
yield output
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
examples=[["Write a heavy metal rock song about horses (1000 words)"],
|
37 |
["Write a really long song about an elephant love story. The elephants have been together for a long time. (3000 words)"],
|
38 |
["Write a slammin rap song about about a gangster fising trip."],
|
@@ -42,5 +62,7 @@ gr.ChatInterface(
|
|
42 |
fn=generate,
|
43 |
chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
44 |
title="Song Writer",
|
|
|
|
|
45 |
concurrency_limit=20,
|
46 |
).launch(show_api=False)
|
|
|
12 |
prompt += f"[INST] {message} [/INST]"
|
13 |
return prompt
|
14 |
|
15 |
+
def generate(prompt,history,seed):
|
16 |
+
#seed = random.randint(1,9999999999999)
|
17 |
|
18 |
system_prompt = prompts.SONG_WRITER
|
19 |
generate_kwargs = dict(
|
|
|
33 |
output += response.token.text
|
34 |
yield output
|
35 |
|
36 |
+
additional_inputs = [
|
37 |
+
gr.Slider(
|
38 |
+
label="Max new tokens",
|
39 |
+
value=4096,
|
40 |
+
minimum=10,
|
41 |
+
maximum=1048*10,
|
42 |
+
step=64,
|
43 |
+
interactive=True,
|
44 |
+
info="The maximum numbers of new tokens",
|
45 |
+
),
|
46 |
+
gr.Slider(
|
47 |
+
label="Seed",
|
48 |
+
value=random.randint(1,9999999999999999),
|
49 |
+
minimum=0,
|
50 |
+
maximum=9999999999999999,
|
51 |
+
step=64,
|
52 |
+
interactive=True,
|
53 |
+
info="Each seed produces a different output to a single prompt",
|
54 |
+
),
|
55 |
+
]
|
56 |
examples=[["Write a heavy metal rock song about horses (1000 words)"],
|
57 |
["Write a really long song about an elephant love story. The elephants have been together for a long time. (3000 words)"],
|
58 |
["Write a slammin rap song about about a gangster fising trip."],
|
|
|
62 |
fn=generate,
|
63 |
chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
64 |
title="Song Writer",
|
65 |
+
additional_inputs=additional_inputs,
|
66 |
+
examples=examples,
|
67 |
concurrency_limit=20,
|
68 |
).launch(show_api=False)
|