Spaces:
Runtime error
Runtime error
Logan Zoellner
commited on
Commit
·
5916805
1
Parent(s):
33f9fc8
rudalle
Browse files
app.py
CHANGED
@@ -110,6 +110,25 @@ def desc_to_image(desc):
|
|
110 |
img=iface(desc, steps, width, height, images, diversity)[0]
|
111 |
return img
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
demo = gr.Blocks()
|
114 |
|
115 |
with demo:
|
@@ -124,7 +143,8 @@ with demo:
|
|
124 |
with gr.Row():
|
125 |
b0 = gr.Button("Randomize name,race and class")
|
126 |
b1 = gr.Button("Generate NPC Description")
|
127 |
-
b2 = gr.Button("Generate Portrait")
|
|
|
128 |
|
129 |
with gr.Row():
|
130 |
input_name = gr.Textbox(label="name",placeholder="Drizzt")
|
@@ -139,6 +159,7 @@ with demo:
|
|
139 |
b0.click(npc_randomize,inputs=[],outputs=[input_name,input_race,input_class,input_pronoun])
|
140 |
b1.click(npc_generate, inputs=[ input_name,input_race,input_class,input_pronoun], outputs=desc_txt)
|
141 |
b2.click(desc_to_image, desc_txt, output_image)
|
|
|
142 |
#examples=examples
|
143 |
|
144 |
demo.launch(enable_queue=True, debug=True)
|
|
|
110 |
img=iface(desc, steps, width, height, images, diversity)[0]
|
111 |
return img
|
112 |
|
113 |
+
def desc_to_image_dalle(desc):
|
114 |
+
print("*****Inside desc_to_image")
|
115 |
+
desc = " ".join(desc.split('\n'))
|
116 |
+
desc = desc + ", character art, concept art, artstation"
|
117 |
+
steps, width, height, images, diversity = '50','256','256','1',15
|
118 |
+
#iface = gr.Interface.load("huggingface/flax-community/dalle-mini")#this isn't a real interface
|
119 |
+
iface = gr.Interface.load("spaces/multimodalart/rudalle")
|
120 |
+
print("about to die",iface,dir(iface))
|
121 |
+
|
122 |
+
prompt = re.sub(r'[^a-zA-Z0-9 ,.]', '', desc)
|
123 |
+
print("about to die",prompt)
|
124 |
+
|
125 |
+
model='Realism'
|
126 |
+
aspect_ratio = 'Square'
|
127 |
+
|
128 |
+
|
129 |
+
img=iface(desc,model,aspect_ratio)[0]
|
130 |
+
return img
|
131 |
+
|
132 |
demo = gr.Blocks()
|
133 |
|
134 |
with demo:
|
|
|
143 |
with gr.Row():
|
144 |
b0 = gr.Button("Randomize name,race and class")
|
145 |
b1 = gr.Button("Generate NPC Description")
|
146 |
+
b2 = gr.Button("Generate Portrait (latent diffusion)")
|
147 |
+
b3 = gr.Button("Generate Portrait (rudalle)")
|
148 |
|
149 |
with gr.Row():
|
150 |
input_name = gr.Textbox(label="name",placeholder="Drizzt")
|
|
|
159 |
b0.click(npc_randomize,inputs=[],outputs=[input_name,input_race,input_class,input_pronoun])
|
160 |
b1.click(npc_generate, inputs=[ input_name,input_race,input_class,input_pronoun], outputs=desc_txt)
|
161 |
b2.click(desc_to_image, desc_txt, output_image)
|
162 |
+
b3.click(desc_to_image_dalle, desc_txt, output_image)
|
163 |
#examples=examples
|
164 |
|
165 |
demo.launch(enable_queue=True, debug=True)
|