Logan Zoellner commited on
Commit
e457e19
Β·
1 Parent(s): ecbc1ab

cleanup img prompt

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -53,20 +53,27 @@ def npc_generate(name,race,characterClass):
53
  def poem_to_image(poem):
54
  print("*****Inside Poem_to_image")
55
  poem = " ".join(poem.split('\n'))
56
- poem = poem + " oil on canvas."
57
  steps, width, height, images, diversity = '50','256','256','1',15
58
  iface = gr.Interface.load("spaces/multimodalart/latentdiffusion")
59
  print("about to die",iface,dir(iface))
 
 
 
 
 
60
  img=iface(poem, steps, width, height, images, diversity)[0]
61
  return img
62
 
63
  demo = gr.Blocks()
64
 
65
  with demo:
66
- gr.Markdown("<h1><center>Generate Short Poem along with an Illustration</center></h1>")
67
  gr.Markdown(
68
- "<div>Enter a single word you would want GPTJ-6B to write Poetry 🎀 on.</div>"
69
- "<div>Generate an illustration 🎨 provided by Latent Diffusion model.</div><div>GPJ-6B is a 6 Billion parameter autoregressive language model. It generates the Poem based on how it has been 'prompt-engineered' πŸ€— The complete text of generated poem then goes in as a prompt to the amazing Latent Diffusion Art space by <a href='https://huggingface.co/spaces/multimodalart/latentdiffusion' target='_blank'>Multimodalart</a>.</div>Please note that some of the Poems/Illustrations might not look at par, and well, this is what happens when you can't 'cherry-pick' and post 😁 <div> Some of the example words that you can use are 'river', 'night', 'trees', 'table', 'laughs' or maybe on similar lines to get best results!"
 
 
70
  )
71
  with gr.Row():
72
 
 
53
  def poem_to_image(poem):
54
  print("*****Inside Poem_to_image")
55
  poem = " ".join(poem.split('\n'))
56
+ poem = poem + ", character art, concept art, artstation"
57
  steps, width, height, images, diversity = '50','256','256','1',15
58
  iface = gr.Interface.load("spaces/multimodalart/latentdiffusion")
59
  print("about to die",iface,dir(iface))
60
+
61
+ prompt = re.sub(r'[^a-zA-Z0-9 .]', '', poem)
62
+ print("about to die",prompt)
63
+
64
+
65
  img=iface(poem, steps, width, height, images, diversity)[0]
66
  return img
67
 
68
  demo = gr.Blocks()
69
 
70
  with demo:
71
+ gr.Markdown("<h1><center>NPC Generator</center></h1>")
72
  gr.Markdown(
73
+ "based on <a href=https://huggingface.co/spaces/Gradio-Blocks/GPTJ6B_Poetry_LatentDiff_Illustration> Gradio poetry generator</a>."
74
+ "<div>first input name, race and class (or generate them randomly)</div>"
75
+ "<div>Next, use GPT-J to generate a short description</div>"
76
+ "<div>Finally, Generate an illustration 🎨 provided by Latent Diffusion model.</div>"
77
  )
78
  with gr.Row():
79