Spaces:
Running
Running
Commit
·
eef06b6
1
Parent(s):
8d5132b
Update app.py
Browse files
app.py
CHANGED
@@ -77,6 +77,8 @@ def generate_txt2img(current_model, prompt, is_negative=False, image_style="None
|
|
77 |
image = Image.open(io.BytesIO(image_bytes))
|
78 |
return image
|
79 |
|
|
|
|
|
80 |
css = """
|
81 |
/* General Container Styles */
|
82 |
.gradio-container {
|
@@ -122,21 +124,29 @@ def generate_txt2img(current_model, text_prompt, negative_prompt, image_style):
|
|
122 |
# Your generation code here
|
123 |
pass
|
124 |
|
125 |
-
|
|
|
|
|
|
|
|
|
126 |
text_prompt = gr.inputs.Textbox(label="Prompt", placeholder="Enter a prompt", lines=1)
|
127 |
negative_prompt = gr.inputs.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", lines=1)
|
128 |
-
image_style = gr.inputs.Dropdown(label="Style", choices=["None style", "Cinematic", "Digital Art", "Portrait"],
|
129 |
-
generate_button = gr.outputs.Button(label="Generate", type="button")
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
77 |
image = Image.open(io.BytesIO(image_bytes))
|
78 |
return image
|
79 |
|
80 |
+
import gradio as gr
|
81 |
+
|
82 |
css = """
|
83 |
/* General Container Styles */
|
84 |
.gradio-container {
|
|
|
124 |
# Your generation code here
|
125 |
pass
|
126 |
|
127 |
+
favicon = '<img src="" width="48px" style="display: inline">'
|
128 |
+
title = f"""<h1><center>{favicon} AI Diffusion</center></h1>"""
|
129 |
+
markdown_title = gr.Markdown(title)
|
130 |
+
|
131 |
+
current_model = gr.inputs.Dropdown(label="Current Model", choices=list_models, value=list_models[1])
|
132 |
text_prompt = gr.inputs.Textbox(label="Prompt", placeholder="Enter a prompt", lines=1)
|
133 |
negative_prompt = gr.inputs.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", lines=1)
|
134 |
+
image_style = gr.inputs.Dropdown(label="Style", choices=["None style", "Cinematic", "Digital Art", "Portrait"], value="None style")
|
|
|
135 |
|
136 |
+
generate_button = gr.outputs.Button(label="Generate", type="button")
|
137 |
+
image_output = gr.outputs.Image(label="Output Image")
|
138 |
+
|
139 |
+
with gr.Blocks(css=css) as demo:
|
140 |
+
gr.Grid(col_width="auto", col_gap="10px").push(
|
141 |
+
markdown_title,
|
142 |
+
current_model,
|
143 |
+
text_prompt,
|
144 |
+
negative_prompt,
|
145 |
+
image_style,
|
146 |
+
generate_button,
|
147 |
+
image_output
|
148 |
+
)
|
149 |
+
|
150 |
+
generate_button.click(generate_txt2img, inputs=[current_model, text_prompt, negative_prompt, image_style], outputs=image_output)
|
151 |
+
|
152 |
+
demo.launch(show_api=False)
|