Spaces:
Runtime error
Runtime error
Logan Zoellner
commited on
Commit
Β·
e457e19
1
Parent(s):
ecbc1ab
cleanup img prompt
Browse files
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 + "
|
| 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>
|
| 67 |
gr.Markdown(
|
| 68 |
-
"<
|
| 69 |
-
"<div>
|
|
|
|
|
|
|
| 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 |
|