DigiP-AI commited on
Commit
e7ea28d
·
verified ·
1 Parent(s): 396ae78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -20
app.py CHANGED
@@ -7,10 +7,10 @@ import time
7
  import numpy as np
8
  import subprocess
9
  import torch
 
10
  from transformers import AutoProcessor, AutoModelForCausalLM
11
  from PIL import Image
12
  from deep_translator import GoogleTranslator
13
- import json
14
  from datetime import datetime
15
  from fastapi import FastAPI
16
 
@@ -124,20 +124,19 @@ examples = [
124
  "a beautiful woman with black hair and brown eyes",
125
  ]
126
 
127
-
128
  css = """
129
  #app-container {
130
  max-width: 930px;
131
  margin-left: auto;
132
  margin-right: auto;
133
  }
134
- ".gradio-container {background: url('file=DigiP-AI/FLUX.Dev-LORA/abstract.jpg')}
135
 
136
  """
137
  with gr.Blocks(theme=theme, css=css, elem_id="app-container") as app:
138
  gr.HTML("<center><h6>🎨 FLUX.1-Dev with LoRA 🇬🇧</h6></center>")
139
  with gr.Tab("Text to Image"):
140
- with gr.Column(elem_id=".gradio-container"):
141
  with gr.Row():
142
  with gr.Column(elem_id="prompt-container"):
143
  with gr.Row():
@@ -147,10 +146,11 @@ with gr.Blocks(theme=theme, css=css, elem_id="app-container") as app:
147
  gr.Markdown("""
148
  - **sdxl-realistic**: szn style
149
  - **stylesdxl-cyberpunk**: szn style
 
150
  - **surreal-harmony**: Surreal Harmony
151
  - **extremely-detailed**: extremely detailed
152
  - **dark-fantasy**: Dark Fantasy
153
- - **analogredmond**: AnalogRedmAF
154
  - **jules-bastien-lepage-style**: Jules Bastien Lepage Style
155
  - **john-singer-sargent-style**: John Singer Sargent Style
156
  - **alphonse-mucha-style**: Alphonse Mucha Style
@@ -162,16 +162,16 @@ with gr.Blocks(theme=theme, css=css, elem_id="app-container") as app:
162
  """)
163
 
164
  with gr.Row():
165
- custom_lora = gr.Dropdown([" ", "jwu114/lora-sdxl-realistic", "issaccyj/lora-sdxl-cyberpunk", "hugovntr/flux-schnell-realism", "fofr/sdxl-deep-down", "KappaNeuro/surreal-harmony", "ntc-ai/SDXL-LoRA-slider.extremely-detailed", "prithivMLmods/Canopus-LoRA-Flux-FaceRealism", "KappaNeuro/dark-fantasy", "artificialguybr/analogredmond", "KappaNeuro/jules-bastien-lepage-style", "KappaNeuro/john-singer-sargent-style", "KappaNeuro/alphonse-mucha-style", "ntc-ai/SDXL-LoRA-slider.ultra-realistic-illustration", "ntc-ai/SDXL-LoRA-slider.eye-catching", "KappaNeuro/john-constable-style", "dvyio/flux-lora-film-noir", "dvyio/flux-lora-pro-headshot"], label="Custom LoRA",)
166
  with gr.Row():
167
  with gr.Accordion("⚙️ Advanced Settings", open=False, elem_id="settings-container"):
168
- negative_prompt = gr.Textbox(label="Negative Prompt", lines=5, placeholder="What should not be in the image", value=" (visible hand:1.3), (ugly:1.3), (duplicate:1.2), (morbid:1.1), (mutilated:1.1), out of frame, bad face, extra fingers, mutated hands, (poorly drawn hands:1.1), (poorly drawn face:1.3), (mutation:1.3), (deformed:1.3), blurry, (bad anatomy:1.1), (bad proportions:1.2), (extra limbs:1.1), cloned face, (disfigured:1.2), gross proportions, malformed limbs, (missing arms:1.1), (missing legs:1.1), (extra arms:1.2), (extra legs:1.2), fused fingers, too many fingers, (long neck:1.2), sketched by bad-artist, (bad-image-v2-39000:1.3) , signature, unprompted-nsfw")
169
  with gr.Row():
170
  width = gr.Slider(label="Image Width", value=896, minimum=64, maximum=1216, step=32)
171
  height = gr.Slider(label="Image Height", value=1152, minimum=64, maximum=1216, step=32)
172
  steps = gr.Slider(label="Sampling steps", value=50, minimum=1, maximum=100, step=1)
173
  cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
174
- method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "PLMS", "UniPC", "UniPC BH2"])
175
  strength = gr.Slider(label="Prompt Strength", value=100, minimum=0, maximum=100, step=1)
176
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
177
  with gr.Row():
@@ -202,16 +202,8 @@ with gr.Blocks(theme=theme, css=css, elem_id="app-container") as app:
202
  image_output = gr.Image(format="png")
203
  with gr.Row():
204
  image_button = gr.Button("Run", variant='primary')
205
- image_button.click(flip_image, inputs=image_input, outputs=image_output)
206
-
207
- with gr.Tab("Information"):
208
- with gr.Row():
209
- gr.Markdown("""
210
- - **Information**:
211
- Some of the LoRAS may not work all of the time, I don't know why, just keep trying them.
212
-
213
- """)
214
-
215
  if __name__ == "__main__":
216
- app.launch(show_api=False, share=False)
217
-
 
7
  import numpy as np
8
  import subprocess
9
  import torch
10
+ import json
11
  from transformers import AutoProcessor, AutoModelForCausalLM
12
  from PIL import Image
13
  from deep_translator import GoogleTranslator
 
14
  from datetime import datetime
15
  from fastapi import FastAPI
16
 
 
124
  "a beautiful woman with black hair and brown eyes",
125
  ]
126
 
 
127
  css = """
128
  #app-container {
129
  max-width: 930px;
130
  margin-left: auto;
131
  margin-right: auto;
132
  }
133
+ ".gradio-container {background: url('file=abstract.jpg')}
134
 
135
  """
136
  with gr.Blocks(theme=theme, css=css, elem_id="app-container") as app:
137
  gr.HTML("<center><h6>🎨 FLUX.1-Dev with LoRA 🇬🇧</h6></center>")
138
  with gr.Tab("Text to Image"):
139
+ with gr.Column(elem_id="app-container"):
140
  with gr.Row():
141
  with gr.Column(elem_id="prompt-container"):
142
  with gr.Row():
 
146
  gr.Markdown("""
147
  - **sdxl-realistic**: szn style
148
  - **stylesdxl-cyberpunk**: szn style
149
+ - **Flux-Super-Realism-LoRA**: Super Realism
150
  - **surreal-harmony**: Surreal Harmony
151
  - **extremely-detailed**: extremely detailed
152
  - **dark-fantasy**: Dark Fantasy
153
+ - **Flux.1-Dev-LoRA-HDR-Realism**: HDR
154
  - **jules-bastien-lepage-style**: Jules Bastien Lepage Style
155
  - **john-singer-sargent-style**: John Singer Sargent Style
156
  - **alphonse-mucha-style**: Alphonse Mucha Style
 
162
  """)
163
 
164
  with gr.Row():
165
+ custom_lora = gr.Dropdown([" ", "jwu114/lora-sdxl-realistic", "issaccyj/lora-sdxl-cyberpunk", "strangerzonehf/Flux-Super-Realism-LoRA", "hugovntr/flux-schnell-realism", "fofr/sdxl-deep-down", "KappaNeuro/surreal-harmony", "ntc-ai/SDXL-LoRA-slider.extremely-detailed", "prithivMLmods/Canopus-LoRA-Flux-FaceRealism", "KappaNeuro/dark-fantasy", "prithivMLmods/Flux.1-Dev-LoRA-HDR-Realism", "KappaNeuro/jules-bastien-lepage-style", "KappaNeuro/john-singer-sargent-style", "KappaNeuro/alphonse-mucha-style", "ntc-ai/SDXL-LoRA-slider.ultra-realistic-illustration", "ntc-ai/SDXL-LoRA-slider.eye-catching", "KappaNeuro/john-constable-style", "dvyio/flux-lora-film-noir", "dvyio/flux-lora-pro-headshot"], label="Custom LoRA",)
166
  with gr.Row():
167
  with gr.Accordion("⚙️ Advanced Settings", open=False, elem_id="settings-container"):
168
+ negative_prompt = gr.Textbox(label="Negative Prompt", lines=5, placeholder="What should not be in the image", value=" Bad anatomy, Bad proportions, Deformed, Disconnected limbs, Disfigured, Extra arms, Extra limbs, Extra hands, Fused fingers, Gross proportions, Long neck, Malformed limbs, Mutated, Mutated hands, Mutated limbs, Missing arms, Missing fingers, Poorly drawn hands, Poorly drawn face ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face, blurry, draft, grainy, text, logo, watermark, banner, extra digits, signature, unprompted-nsfw")
169
  with gr.Row():
170
  width = gr.Slider(label="Image Width", value=896, minimum=64, maximum=1216, step=32)
171
  height = gr.Slider(label="Image Height", value=1152, minimum=64, maximum=1216, step=32)
172
  steps = gr.Slider(label="Sampling steps", value=50, minimum=1, maximum=100, step=1)
173
  cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
174
+ method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "PLMS", "UniPC", "UniPC BH2"])
175
  strength = gr.Slider(label="Prompt Strength", value=100, minimum=0, maximum=100, step=1)
176
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
177
  with gr.Row():
 
202
  image_output = gr.Image(format="png")
203
  with gr.Row():
204
  image_button = gr.Button("Run", variant='primary')
205
+ image_button.click(flip_image, inputs=image_input, outputs=image_output, concurrency_limit=None)
206
+
207
+ app.queue() # <-- Sets up a queue with default parameters
 
 
 
 
 
 
 
208
  if __name__ == "__main__":
209
+ app.launch(show_api=False, share=True)