Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -46,10 +46,13 @@ def infer(text,title):
|
|
46 |
Please make sure not to include text in the image."""
|
47 |
image_url_openai, revised_prompt = generate_image_openai(prompt)
|
48 |
style_image_url = style_transfer(image_url_openai, f'./Style.png',revised_prompt)
|
|
|
|
|
|
|
49 |
response = requests.get(style_image_url)
|
50 |
img = Image.open(BytesIO(response.content))
|
51 |
|
52 |
-
return img
|
53 |
|
54 |
|
55 |
|
@@ -62,12 +65,12 @@ examples = [
|
|
62 |
# "A delicious ceviche cheesecake slice",
|
63 |
]
|
64 |
|
65 |
-
css="""
|
66 |
-
#col-container {
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
-
"""
|
71 |
|
72 |
|
73 |
|
@@ -84,19 +87,20 @@ with gr.Blocks(css=css) as demo:
|
|
84 |
label="Text",
|
85 |
show_label=False,
|
86 |
max_lines=1,
|
87 |
-
placeholder="Enter
|
88 |
container=False,
|
89 |
)
|
90 |
title = gr.Text(
|
91 |
label="Title",
|
92 |
show_label=False,
|
93 |
max_lines=1,
|
94 |
-
placeholder="Enter
|
95 |
container=False,
|
96 |
)
|
97 |
|
98 |
run_button = gr.Button("Run", scale=0)
|
99 |
|
|
|
100 |
result = gr.Image(label="Result", show_label=False)
|
101 |
|
102 |
# with gr.Accordion("Advanced Settings", open=False):
|
@@ -162,7 +166,7 @@ with gr.Blocks(css=css) as demo:
|
|
162 |
run_button.click(
|
163 |
fn = infer,
|
164 |
inputs = [text, title],
|
165 |
-
outputs = [result]
|
166 |
)
|
167 |
|
168 |
demo.queue().launch()
|
|
|
46 |
Please make sure not to include text in the image."""
|
47 |
image_url_openai, revised_prompt = generate_image_openai(prompt)
|
48 |
style_image_url = style_transfer(image_url_openai, f'./Style.png',revised_prompt)
|
49 |
+
|
50 |
+
response_dalle = requests.get(image_url_openai)
|
51 |
+
dalle_img = Image.open(BytesIO(response.content))
|
52 |
response = requests.get(style_image_url)
|
53 |
img = Image.open(BytesIO(response.content))
|
54 |
|
55 |
+
return dalle_img, img
|
56 |
|
57 |
|
58 |
|
|
|
65 |
# "A delicious ceviche cheesecake slice",
|
66 |
]
|
67 |
|
68 |
+
# css="""
|
69 |
+
# #col-container {
|
70 |
+
# margin: 0 auto;
|
71 |
+
# max-width: 520px;
|
72 |
+
# }
|
73 |
+
# """
|
74 |
|
75 |
|
76 |
|
|
|
87 |
label="Text",
|
88 |
show_label=False,
|
89 |
max_lines=1,
|
90 |
+
placeholder="Enter the `text`",
|
91 |
container=False,
|
92 |
)
|
93 |
title = gr.Text(
|
94 |
label="Title",
|
95 |
show_label=False,
|
96 |
max_lines=1,
|
97 |
+
placeholder="Enter the `title`",
|
98 |
container=False,
|
99 |
)
|
100 |
|
101 |
run_button = gr.Button("Run", scale=0)
|
102 |
|
103 |
+
dalle = gr.Image(label="dalle", show_label=False)
|
104 |
result = gr.Image(label="Result", show_label=False)
|
105 |
|
106 |
# with gr.Accordion("Advanced Settings", open=False):
|
|
|
166 |
run_button.click(
|
167 |
fn = infer,
|
168 |
inputs = [text, title],
|
169 |
+
outputs = [dalle,result]
|
170 |
)
|
171 |
|
172 |
demo.queue().launch()
|