Spaces:
Runtime error
Runtime error
egosumkira
commited on
Commit
•
19d38a8
1
Parent(s):
db41a32
remove start text
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ story = pipeline(
|
|
13 |
)
|
14 |
|
15 |
|
16 |
-
def generate(tags_text,
|
17 |
tags = tags_text.split(", ")
|
18 |
-
prefix = f"~^{'^'.join(tags)}~@
|
19 |
g_text = story(prefix, temperature=1.0, max_length=128, repetition_penalty=7.0, num_beams=3)[0]['generated_text']
|
20 |
return g_text[g_text.find("@") + 1:]
|
21 |
|
@@ -29,7 +29,6 @@ description = "This model can generate short fantasy story based on set of keywo
|
|
29 |
iface = gr.Interface(generate,
|
30 |
inputs = [
|
31 |
gr.Textbox(label="Keywords (comma separated)"),
|
32 |
-
gr.Textbox(label="Beggining of the text (optional)"),
|
33 |
gr.inputs.Slider(0, 2, default=1.0, step=0.05, label="Temperature"),
|
34 |
gr.Number(label="Max lenght", value=128),
|
35 |
gr.inputs.Slider(1, 10, default=3, label="Number of beams in Beam Search", step=1)
|
|
|
13 |
)
|
14 |
|
15 |
|
16 |
+
def generate(tags_text, temp=1.0, n_beams=3, max_l=128):
|
17 |
tags = tags_text.split(", ")
|
18 |
+
prefix = f"~^{'^'.join(tags)}~@"
|
19 |
g_text = story(prefix, temperature=1.0, max_length=128, repetition_penalty=7.0, num_beams=3)[0]['generated_text']
|
20 |
return g_text[g_text.find("@") + 1:]
|
21 |
|
|
|
29 |
iface = gr.Interface(generate,
|
30 |
inputs = [
|
31 |
gr.Textbox(label="Keywords (comma separated)"),
|
|
|
32 |
gr.inputs.Slider(0, 2, default=1.0, step=0.05, label="Temperature"),
|
33 |
gr.Number(label="Max lenght", value=128),
|
34 |
gr.inputs.Slider(1, 10, default=3, label="Number of beams in Beam Search", step=1)
|