rawc0der commited on
Commit
95926f3
·
1 Parent(s): 4625abf

update interface

Browse files
Files changed (2) hide show
  1. app.py +8 -10
  2. requirements.txt +20 -18
app.py CHANGED
@@ -254,8 +254,7 @@ def create_gradio_interface():
254
  model_dropdown = gr.Dropdown(
255
  choices=list(MODELS.keys()),
256
  value=list(MODELS.keys())[0],
257
- label="Select Model",
258
- info="Choose the model for image generation"
259
  )
260
 
261
  prompt = gr.Textbox(
@@ -298,13 +297,12 @@ def create_gradio_interface():
298
 
299
  reference_image = gr.Image(
300
  type="pil",
301
- label="Reference Image (optional)",
302
- info="Upload an image for img2img generation"
303
  )
304
 
305
  with gr.Row():
306
  generate_btn = gr.Button("Generate", variant="primary")
307
- unload_btn = gr.Button("Unload Model", variant="secondary")
308
 
309
  with gr.Column(scale=2):
310
  output_image = gr.Image(label="Generated Image")
@@ -316,24 +314,24 @@ def create_gradio_interface():
316
  def update_params(model_name):
317
  model_config = MODELS[model_name]["parameters"]
318
  return [
319
- gr.Slider.update(
320
  minimum=model_config["height"]["min"],
321
  maximum=model_config["height"]["max"],
322
  value=model_config["height"]["default"],
323
  step=model_config["height"]["step"]
324
  ),
325
- gr.Slider.update(
326
  minimum=model_config["width"]["min"],
327
  maximum=model_config["width"]["max"],
328
  value=model_config["width"]["default"],
329
  step=model_config["width"]["step"]
330
  ),
331
- gr.Slider.update(
332
  minimum=model_config["num_inference_steps"]["min"],
333
  maximum=model_config["num_inference_steps"]["max"],
334
  value=model_config["num_inference_steps"]["default"]
335
  ),
336
- gr.Slider.update(
337
  minimum=model_config["guidance_scale"]["min"],
338
  maximum=model_config["guidance_scale"]["max"],
339
  value=model_config["guidance_scale"]["default"]
@@ -378,7 +376,7 @@ def create_gradio_interface():
378
  )
379
 
380
  return interface
381
-
382
  if __name__ == "__main__":
383
  import uvicorn
384
  from threading import Thread
 
254
  model_dropdown = gr.Dropdown(
255
  choices=list(MODELS.keys()),
256
  value=list(MODELS.keys())[0],
257
+ label="Select Model"
 
258
  )
259
 
260
  prompt = gr.Textbox(
 
297
 
298
  reference_image = gr.Image(
299
  type="pil",
300
+ label="Reference Image (optional)"
 
301
  )
302
 
303
  with gr.Row():
304
  generate_btn = gr.Button("Generate", variant="primary")
305
+ unload_btn = gr.Button("Unload Model")
306
 
307
  with gr.Column(scale=2):
308
  output_image = gr.Image(label="Generated Image")
 
314
  def update_params(model_name):
315
  model_config = MODELS[model_name]["parameters"]
316
  return [
317
+ gr.update(
318
  minimum=model_config["height"]["min"],
319
  maximum=model_config["height"]["max"],
320
  value=model_config["height"]["default"],
321
  step=model_config["height"]["step"]
322
  ),
323
+ gr.update(
324
  minimum=model_config["width"]["min"],
325
  maximum=model_config["width"]["max"],
326
  value=model_config["width"]["default"],
327
  step=model_config["width"]["step"]
328
  ),
329
+ gr.update(
330
  minimum=model_config["num_inference_steps"]["min"],
331
  maximum=model_config["num_inference_steps"]["max"],
332
  value=model_config["num_inference_steps"]["default"]
333
  ),
334
+ gr.update(
335
  minimum=model_config["guidance_scale"]["min"],
336
  maximum=model_config["guidance_scale"]["max"],
337
  value=model_config["guidance_scale"]["default"]
 
376
  )
377
 
378
  return interface
379
+
380
  if __name__ == "__main__":
381
  import uvicorn
382
  from threading import Thread
requirements.txt CHANGED
@@ -1,18 +1,20 @@
1
- fastapi>=0.104.0
2
- uvicorn>=0.24.0
3
- python-multipart>=0.0.6
4
- gradio>=4.11.0
5
- torch>=2.1.0
6
- torchvision>=0.16.0
7
- diffusers>=0.24.0
8
- transformers>=4.36.0
9
- accelerate>=0.25.0
10
- safetensors>=0.4.0
11
- xformers>=0.0.22.post7 # Optional but recommended for memory efficiency
12
- pillow>=10.0.0
13
- numpy>=1.24.0
14
- packaging>=23.2
15
- pydantic>=2.5.0
16
- tqdm>=4.66.0
17
- typing-extensions>=4.8.0
18
- python-dotenv>=1.0.0
 
 
 
1
+ fastapi==0.95.2
2
+ uvicorn==0.22.0
3
+ python-multipart==0.0.6
4
+ gradio==3.32.0
5
+ torch==2.0.1
6
+ torchvision==0.15.2
7
+ diffusers==0.18.2
8
+ transformers==4.30.2
9
+ accelerate==0.20.3
10
+ safetensors==0.3.1
11
+ pillow==9.5.0
12
+ numpy==1.24.3
13
+ packaging==23.1
14
+ pydantic==1.10.8
15
+ tqdm==4.65.0
16
+ typing-extensions==4.6.3
17
+ python-dotenv==1.0.0
18
+
19
+ # Optional but recommended for memory efficiency
20
+ xformers==0.0.20