Spaces:
Runtime error
Runtime error
Songwei Ge
commited on
Commit
•
b624d65
1
Parent(s):
bf77ce6
seperate the image;
Browse files
app.py
CHANGED
@@ -96,13 +96,12 @@ def main():
|
|
96 |
text_format_dict=text_format_dict)
|
97 |
print('time lapses to generate image from rich text: %.4f' %
|
98 |
(time.time()-begin_time))
|
99 |
-
|
100 |
-
return [cat_img, token_maps]
|
101 |
|
102 |
with gr.Blocks() as demo:
|
103 |
gr.HTML("""<h1 style="font-weight: 900; margin-bottom: 7px;">Expressive Text-to-Image Generation with Rich Text</h1>
|
104 |
<p> Visit our <a href="https://rich-text-to-image.github.io/rich-text-to-json.html">rich-text-to-json interface</a> to generate rich-text JSON input.<p/>
|
105 |
-
<p> <a href="https://rich-text-to-image.github.io">Website</a> | <a href="https://github.com/SongweiGe/rich-text-to-image">Code</a> <p/> """)
|
106 |
with gr.Row():
|
107 |
with gr.Column():
|
108 |
text_input = gr.Textbox(
|
@@ -148,8 +147,10 @@ def main():
|
|
148 |
generate_button = gr.Button("Generate")
|
149 |
|
150 |
with gr.Column():
|
151 |
-
|
152 |
-
|
|
|
|
|
153 |
|
154 |
with gr.Row():
|
155 |
gr.Markdown(help_text)
|
@@ -215,7 +216,8 @@ def main():
|
|
215 |
color_guidance_weight,
|
216 |
],
|
217 |
outputs=[
|
218 |
-
|
|
|
219 |
token_map,
|
220 |
],
|
221 |
fn=generate,
|
@@ -234,7 +236,7 @@ def main():
|
|
234 |
guidance_weight,
|
235 |
color_guidance_weight,
|
236 |
],
|
237 |
-
outputs=[
|
238 |
)
|
239 |
|
240 |
demo.queue(concurrency_count=1)
|
|
|
96 |
text_format_dict=text_format_dict)
|
97 |
print('time lapses to generate image from rich text: %.4f' %
|
98 |
(time.time()-begin_time))
|
99 |
+
return [plain_img[0], rich_img[0], token_maps]
|
|
|
100 |
|
101 |
with gr.Blocks() as demo:
|
102 |
gr.HTML("""<h1 style="font-weight: 900; margin-bottom: 7px;">Expressive Text-to-Image Generation with Rich Text</h1>
|
103 |
<p> Visit our <a href="https://rich-text-to-image.github.io/rich-text-to-json.html">rich-text-to-json interface</a> to generate rich-text JSON input.<p/>
|
104 |
+
<p> <a href="https://rich-text-to-image.github.io">[Website]</a> | <a href="https://github.com/SongweiGe/rich-text-to-image">[Code]</a> <p/> """)
|
105 |
with gr.Row():
|
106 |
with gr.Column():
|
107 |
text_input = gr.Textbox(
|
|
|
147 |
generate_button = gr.Button("Generate")
|
148 |
|
149 |
with gr.Column():
|
150 |
+
with gr.Row():
|
151 |
+
plaintext_result = gr.Image(label='Plain-text Result')
|
152 |
+
richtext_result = gr.Image(label='Rich-text Result')
|
153 |
+
token_map = gr.Image(label='Token Maps')
|
154 |
|
155 |
with gr.Row():
|
156 |
gr.Markdown(help_text)
|
|
|
216 |
color_guidance_weight,
|
217 |
],
|
218 |
outputs=[
|
219 |
+
plaintext_result,
|
220 |
+
richtext_result,
|
221 |
token_map,
|
222 |
],
|
223 |
fn=generate,
|
|
|
236 |
guidance_weight,
|
237 |
color_guidance_weight,
|
238 |
],
|
239 |
+
outputs=[plaintext_result, richtext_result, token_map],
|
240 |
)
|
241 |
|
242 |
demo.queue(concurrency_count=1)
|