akhooli commited on
Commit
2352803
1 Parent(s): 646c6c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
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.inputs.Textbox(label="Enter short prompt or select from examples:", placeholder="أنا الذي"),
34
- gr.inputs.Slider(0.80, 1.0, step=0.01,default=0.95, label='control temperature'),
35
- gr.inputs.Slider(25, 100, step=1,default=50, label='control top k'),
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
 
@@ -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()