Politrees commited on
Commit
1fa1748
1 Parent(s): 9e61afc

Redesign of the interface (by. Politrees)

Browse files

How do you like this interface redesign?

![Скриншот 17-07-2024 144153.png](https://cdn-uploads.huggingface.co/production/uploads/63dcb906043d6c11093c9274/qBYLVNUidY88OGb93swJC.png)

Files changed (1) hide show
  1. app.py +25 -42
app.py CHANGED
@@ -84,8 +84,6 @@ def image_to_base64(image_path):
84
 
85
  return img_str.decode('utf-8') # Convert bytes to string
86
 
87
-
88
-
89
  prodia_client = Prodia(api_key=os.getenv("PRODIA_API_KEY"))
90
 
91
  def flip_text(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
@@ -119,51 +117,36 @@ css = """
119
  }
120
  """
121
 
122
- with gr.Blocks(css=css) as demo:
123
-
124
-
125
  with gr.Row():
126
- with gr.Column(scale=6):
127
- model = gr.Dropdown(interactive=True,value="sd_xl_base_1.0.safetensors [be9edd61]", show_label=True, label="Stable Diffusion Checkpoint", choices=prodia_client.list_models())
128
-
129
- with gr.Column(scale=1):
130
  gr.Markdown(elem_id="powered-by-prodia", value="AUTOMATIC1111 Stable Diffusion Web UI for SDXL V1.0.<br>Powered by [Prodia](https://prodia.com).")
131
 
132
- with gr.Tab("txt2img"):
133
- with gr.Row():
134
- with gr.Column(scale=6, min_width=600):
135
- prompt = gr.Textbox("space warrior, beautiful, female, ultrarealistic, soft lighting, 8k", placeholder="Prompt", show_label=False, lines=3)
136
- negative_prompt = gr.Textbox(placeholder="Negative Prompt", show_label=False, lines=3, value="3d, cartoon, anime, (deformed eyes, nose, ears, nose), bad anatomy, ugly")
 
 
 
 
 
 
 
137
  with gr.Column():
138
- text_button = gr.Button("Generate", variant='primary', elem_id="generate")
139
-
140
- with gr.Row():
141
- with gr.Column(scale=3):
142
- with gr.Tab("Generation"):
143
- with gr.Row():
144
- with gr.Column(scale=1):
145
- sampler = gr.Dropdown(value="DPM++ 2M Karras", show_label=True, label="Sampling Method", choices=prodia_client.list_samplers())
146
-
147
- with gr.Column(scale=1):
148
- steps = gr.Slider(label="Sampling Steps", minimum=1, maximum=25, value=20, step=1)
149
-
150
- with gr.Row():
151
- with gr.Column(scale=1):
152
- width = gr.Slider(label="Width", minimum=512, maximum=1536, value=1024, step=8)
153
- height = gr.Slider(label="Height", minimum=512, maximum=1536, value=1024, step=8)
154
- gr.Markdown(elem_id="resolution", value="*Resolution Maximum: 1MP (1048576 px)*")
155
-
156
- with gr.Column(scale=1):
157
- batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)
158
- batch_count = gr.Slider(label="Batch Count", maximum=1, value=1)
159
-
160
- cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, value=7, step=1)
161
- seed = gr.Number(label="Seed", value=-1)
162
-
163
 
164
- with gr.Column(scale=2):
165
- image_output = gr.Image(value="https://cdn-uploads.huggingface.co/production/uploads/noauth/XWJyh9DhMGXrzyRJk7SfP.png")
166
 
167
- text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
168
 
169
  demo.queue(default_concurrency_limit=1, max_size=32, api_open=False).launch(max_threads=128)
 
84
 
85
  return img_str.decode('utf-8') # Convert bytes to string
86
 
 
 
87
  prodia_client = Prodia(api_key=os.getenv("PRODIA_API_KEY"))
88
 
89
  def flip_text(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
 
117
  }
118
  """
119
 
120
+ with gr.Blocks(css=css, theme=gr.themes.Default(spacing_size="sm", radius_size="lg")) as demo:
 
 
121
  with gr.Row():
122
+ with gr.Column(scale=3, variant='panel'):
123
+ model = gr.Dropdown(label="Stable Diffusion Checkpoint", value="sd_xl_base_1.0.safetensors [be9edd61]", choices=prodia_client.list_models())
124
+ with gr.Column(scale=1, variant='panel'):
 
125
  gr.Markdown(elem_id="powered-by-prodia", value="AUTOMATIC1111 Stable Diffusion Web UI for SDXL V1.0.<br>Powered by [Prodia](https://prodia.com).")
126
 
127
+ with gr.Row():
128
+ with gr.Column(scale=3, variant='panel'):
129
+ prompt = gr.Textbox(value="space warrior, beautiful, female, ultrarealistic, soft lighting, 8k", placeholder="Prompt", show_label=False, lines=3, max_lines=5)
130
+ negative_prompt = gr.Textbox(value="3d, cartoon, anime, (deformed eyes, nose, ears, nose), bad anatomy, ugly", placeholder="Negative Prompt", show_label=False, lines=3, max_lines=5)
131
+ with gr.Column(scale=1, variant='panel'):
132
+ text_button = gr.Button("Generate", variant='primary', elem_id="generate")
133
+
134
+ with gr.Row(equal_height=False):
135
+ with gr.Column(scale=3, variant='panel'):
136
+ with gr.Row():
137
+ sampler = gr.Dropdown(label="Sampling Method", value="DPM++ 2M Karras", choices=prodia_client.list_samplers())
138
+ steps = gr.Slider(label="Sampling Steps", minimum=1, maximum=100, value=20, step=1)
139
  with gr.Column():
140
+ width = gr.Slider(label="Width", minimum=512, maximum=1536, value=1024, step=8)
141
+ height = gr.Slider(label="Height", minimum=512, maximum=1536, value=1024, step=8)
142
+ gr.HTML("<center><h3>Resolution Maximum: 1MP (1048576 px)</h3></center>")
143
+ with gr.Column():
144
+ cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, value=7, step=1)
145
+ seed = gr.Number(label="Seed", value=-1)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
+ with gr.Column(scale=2):
148
+ image_output = gr.Image(value="https://cdn-uploads.huggingface.co/production/uploads/noauth/XWJyh9DhMGXrzyRJk7SfP.png")
149
 
150
+ text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
151
 
152
  demo.queue(default_concurrency_limit=1, max_size=32, api_open=False).launch(max_threads=128)