akhooli commited on
Commit
8a73eeb
1 Parent(s): 86de1ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -25,13 +25,13 @@ 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"]
26
  poetry =""
27
  for line in gen.split('.')[:-1]:
28
- poetry += line + "\n"
29
  return poetry
30
  poetry = gr.Interface(fn=sayPoetry,
31
  inputs=[
32
  gr.inputs.Textbox(label="Enter short prompt or select from examples:", placeholder="أنا الذي"),
33
  gr.inputs.Slider(0.80, 1.0, step=0.01,default=0.95, label='control temperature'),
34
- gr.inputs.Slider(20, 100, step=1,default=50, label='control top k'),
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
  ],
@@ -39,7 +39,7 @@ poetry = gr.Interface(fn=sayPoetry,
39
 
40
  allow_flagging='never',
41
  title='Arabic Poetry Generation Demo (updated Jan. 2023)',
42
- description = "a simple demo of AI generated poetry based on 1M poems fine-tuned using AraGPT2 (be patient, runs on cpu)",
43
  examples=samples,
44
  article = notes)
45
  poetry.launch()
 
25
  gen = pipe(prompt, max_length=96, temperature = temp, top_k=topk, top_p=topp, repetition_penalty=penalty)[0]["generated_text"]
26
  poetry =""
27
  for line in gen.split('.')[:-1]:
28
+ poetry += line #+ "\n"
29
  return poetry
30
  poetry = gr.Interface(fn=sayPoetry,
31
  inputs=[
32
  gr.inputs.Textbox(label="Enter short prompt or select from examples:", placeholder="أنا الذي"),
33
  gr.inputs.Slider(0.80, 1.0, step=0.01,default=0.95, label='control temperature'),
34
+ gr.inputs.Slider(25, 100, step=1,default=50, label='control top k'),
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
  ],
 
39
 
40
  allow_flagging='never',
41
  title='Arabic Poetry Generation Demo (updated Jan. 2023)',
42
+ description = "A simple demo of AI generated poetry based on 1M poems fine-tuned using AraGPT2 (be patient, runs on cpu)",
43
  examples=samples,
44
  article = notes)
45
  poetry.launch()