akhooli commited on
Commit
2f068c3
1 Parent(s): bb1772f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  from transformers import pipeline
4
 
5
  pipe = pipeline('text-generation', model='akhooli/ap2023', tokenizer='akhooli/ap2023')
6
- gc.collect()
7
 
8
  def sayPoetry(prompt):
9
  gen = pipe(prompt, max_length=96)[0]["generated_text"]
@@ -13,9 +13,9 @@ def sayPoetry(prompt):
13
  return poetry
14
 
15
  tb = gr.Textbox(label="Enter your prompt or select from examples:", placeholder="أنا الذي", lines=1)
16
- p_app = gr.Interface(fn=sayPoetry, inputs=tb, outputs="text", allow_flagging='never',
17
  title='Arabic Poetry Generation Demo (updated Jan. 2023)',
18
  description = "a simple demo of AI generated poetry based on 1M poems fine-tuned using AraGPT2 (be patient, runs on cpu)",
19
- examples=[['أنت'],['لولا كتاب'], ['ألا ليت'],['يا قدس'],['عيد بأية حال'], ['لكل شيء إذا ما'],['.']])
20
 
21
- p_app.launch()
 
3
  from transformers import pipeline
4
 
5
  pipe = pipeline('text-generation', model='akhooli/ap2023', tokenizer='akhooli/ap2023')
6
+ #gc.collect()
7
 
8
  def sayPoetry(prompt):
9
  gen = pipe(prompt, max_length=96)[0]["generated_text"]
 
13
  return poetry
14
 
15
  tb = gr.Textbox(label="Enter your prompt or select from examples:", placeholder="أنا الذي", lines=1)
16
+ poetry = gr.Interface(fn=sayPoetry, inputs=tb, outputs="text", allow_flagging='never',
17
  title='Arabic Poetry Generation Demo (updated Jan. 2023)',
18
  description = "a simple demo of AI generated poetry based on 1M poems fine-tuned using AraGPT2 (be patient, runs on cpu)",
19
+ examples=[['أنت'],['لولا كتاب'],['ألا ليت'],['يا قدس'],['عيد بأية حال'],['لكل شيء إذا ما'],['.']])
20
 
21
+ poetry.launch()