Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ notes = """
|
|
29 |
- Feedback (Twitter): @akhooli (https://twitter.com/akhooli/status/1611025232201977859)
|
30 |
- Note/Disclaimer: may generate unaccepted or inappropriate content. Use at your own risk.
|
31 |
"""
|
32 |
-
def sayPoetry(prompt, temp=0
|
33 |
gen = pipe(prompt, max_length=96, temperature = temp, top_k=topk, top_p=topp, repetition_penalty=penalty)[0]["generated_text"]
|
34 |
poetry =""
|
35 |
for line in gen.split('.')[:-1]:
|
@@ -38,7 +38,7 @@ def sayPoetry(prompt, temp=0.95, topk = 50, topp = 0.92, penalty=1.0):
|
|
38 |
poetry = gr.Interface(fn=sayPoetry,
|
39 |
inputs=[
|
40 |
gr.Textbox(label="Enter short prompt or select from examples:"),
|
41 |
-
gr.Slider(0.80, 1.0, step=0.01,default=0
|
42 |
gr.Slider(25, 100, step=1,default=50, label='control top k'),
|
43 |
gr.Slider(0.80, 1.0, step=0.01,default=1.0, label='control top p'),
|
44 |
gr.Slider(0.90, 1.20, step=0.01,default=1.0, label='control penalty'),
|
@@ -51,4 +51,4 @@ poetry = gr.Interface(fn=sayPoetry,
|
|
51 |
examples=samples,
|
52 |
cache_examples=False,
|
53 |
article = notes)
|
54 |
-
poetry.launch()
|
|
|
29 |
- Feedback (Twitter): @akhooli (https://twitter.com/akhooli/status/1611025232201977859)
|
30 |
- Note/Disclaimer: may generate unaccepted or inappropriate content. Use at your own risk.
|
31 |
"""
|
32 |
+
def sayPoetry(prompt, temp=1.0, topk = 50, topp = 1.0, penalty=1.0):
|
33 |
gen = pipe(prompt, max_length=96, temperature = temp, top_k=topk, top_p=topp, repetition_penalty=penalty)[0]["generated_text"]
|
34 |
poetry =""
|
35 |
for line in gen.split('.')[:-1]:
|
|
|
38 |
poetry = gr.Interface(fn=sayPoetry,
|
39 |
inputs=[
|
40 |
gr.Textbox(label="Enter short prompt or select from examples:"),
|
41 |
+
gr.Slider(0.80, 1.0, step=0.01,default=1.0, label='control temperature'),
|
42 |
gr.Slider(25, 100, step=1,default=50, label='control top k'),
|
43 |
gr.Slider(0.80, 1.0, step=0.01,default=1.0, label='control top p'),
|
44 |
gr.Slider(0.90, 1.20, step=0.01,default=1.0, label='control penalty'),
|
|
|
51 |
examples=samples,
|
52 |
cache_examples=False,
|
53 |
article = notes)
|
54 |
+
poetry.launch(show_error = True)
|