Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,8 @@ notes = """
|
|
19 |
- Clear and enter new prompt or select another example and SEND to regenerate
|
20 |
- The '.' means start a new line from no prompt (your prompt need not be long)
|
21 |
- Be patient: this runs on CPU (free tier)
|
22 |
-
- Feedback (Twitter): @akhooli (https://twitter.com/akhooli/status/1611025232201977859)
|
|
|
23 |
"""
|
24 |
def sayPoetry(prompt, temp=0.95, topk = 50, topp = 0.92, penalty=1.0):
|
25 |
gen = pipe(prompt, max_length=96, temperature = temp, top_k=topk, top_p=topp, repetition_penalty=penalty)[0]["generated_text"]
|
@@ -35,11 +36,12 @@ poetry = gr.Interface(fn=sayPoetry,
|
|
35 |
gr.inputs.Slider(0.80, 1.0, step=0.01,default=1.0, label='control top p'),
|
36 |
gr.inputs.Slider(0.90, 1.20, step=0.01,default=1.20, label='control penalty'),
|
37 |
],
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
44 |
article = notes)
|
45 |
poetry.launch()
|
|
|
19 |
- Clear and enter new prompt or select another example and SEND to regenerate
|
20 |
- The '.' means start a new line from no prompt (your prompt need not be long)
|
21 |
- Be patient: this runs on CPU (free tier)
|
22 |
+
- Feedback (Twitter): @akhooli (https://twitter.com/akhooli/status/1611025232201977859)
|
23 |
+
- Note/Disclaimer: may generate unaccepted or inappropriate contednt. Use at your own risk.
|
24 |
"""
|
25 |
def sayPoetry(prompt, temp=0.95, topk = 50, topp = 0.92, penalty=1.0):
|
26 |
gen = pipe(prompt, max_length=96, temperature = temp, top_k=topk, top_p=topp, repetition_penalty=penalty)[0]["generated_text"]
|
|
|
36 |
gr.inputs.Slider(0.80, 1.0, step=0.01,default=1.0, label='control top p'),
|
37 |
gr.inputs.Slider(0.90, 1.20, step=0.01,default=1.20, label='control penalty'),
|
38 |
],
|
39 |
+
outputs=[gr.outputs.Textbox(label="Generated Poetry:")],
|
40 |
|
41 |
+
allow_flagging='never',
|
42 |
+
title='Arabic Poetry Generation Demo (updated Jan. 2023)',
|
43 |
+
description = "A simple demo of AI generated poetry based on 1M poems fine-tuned using AraGPT2 (be patient, runs on cpu)",
|
44 |
+
examples=samples,
|
45 |
+
cache_examples=False,
|
46 |
article = notes)
|
47 |
poetry.launch()
|