Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,14 @@ from transformers import pipeline
|
|
4 |
|
5 |
pipe = pipeline('text-generation', framework='pt', model='akhooli/ap2023', tokenizer='akhooli/ap2023')
|
6 |
#gc.collect()
|
7 |
-
samples = [['أنت'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
#samples = [['أنت'
|
9 |
# ,.96],['هل غادر'
|
10 |
# , 1.0],['ألا ليت'
|
@@ -30,11 +37,11 @@ def sayPoetry(prompt, temp=0.95, topk = 50, topp = 0.92, penalty=1.0):
|
|
30 |
return poetry
|
31 |
poetry = gr.Interface(fn=sayPoetry,
|
32 |
inputs=[
|
33 |
-
gr.
|
34 |
-
gr.
|
35 |
-
gr.
|
36 |
-
gr.
|
37 |
-
gr.
|
38 |
],
|
39 |
outputs=[gr.outputs.Textbox(label="Generated Poetry:")],
|
40 |
|
@@ -42,6 +49,6 @@ poetry = gr.Interface(fn=sayPoetry,
|
|
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()
|
|
|
4 |
|
5 |
pipe = pipeline('text-generation', framework='pt', model='akhooli/ap2023', tokenizer='akhooli/ap2023')
|
6 |
#gc.collect()
|
7 |
+
samples = [['أنت'
|
8 |
+
,None, None, None, None],['هل غادر'
|
9 |
+
,None, None, None, None ],['ألا ليت'
|
10 |
+
,None, None, None, None ],['يا قدس'
|
11 |
+
,None, None, None, None],['عيد بأية حال'
|
12 |
+
,None, None, None, None],['لكل شيء إذا ما'
|
13 |
+
,None, None, None, None ],['.'
|
14 |
+
,None, None, None, None]]
|
15 |
#samples = [['أنت'
|
16 |
# ,.96],['هل غادر'
|
17 |
# , 1.0],['ألا ليت'
|
|
|
37 |
return poetry
|
38 |
poetry = gr.Interface(fn=sayPoetry,
|
39 |
inputs=[
|
40 |
+
gr.Textbox(label="Enter short prompt or select from examples:", placeholder="أنا الذي"),
|
41 |
+
gr.Slider(0.80, 1.0, step=0.01,default=0.95, 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.20, label='control penalty'),
|
45 |
],
|
46 |
outputs=[gr.outputs.Textbox(label="Generated Poetry:")],
|
47 |
|
|
|
49 |
title='Arabic Poetry Generation Demo (updated Jan. 2023)',
|
50 |
description = "A simple demo of AI generated poetry based on 1M poems fine-tuned using AraGPT2 (be patient, runs on cpu)",
|
51 |
examples=samples,
|
52 |
+
#cache_examples=False,
|
53 |
article = notes)
|
54 |
poetry.launch()
|