DigiP-AI commited on
Commit
0d0b73d
·
verified ·
1 Parent(s): d093dac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -4
app.py CHANGED
@@ -297,11 +297,45 @@ with gr.Blocks(theme=theme, css=css) as app:
297
  #gr.load("models/XLabs-AI/flux-RealismLora")
298
  #gr.load("models/digiplay/AnalogMadness-realistic-model-v7")
299
  #gr.load("stabilityai/stable-diffusion-3-medium-diffusers")
300
- gr.Interface.load("models/dvyio/flux-lora-film-noir")
301
- base_model_id = "dvyio/flux-lora-film-noir"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
 
303
-
304
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
 
306
 
307
  with gr.Tab("Flip Image"):
 
297
  #gr.load("models/XLabs-AI/flux-RealismLora")
298
  #gr.load("models/digiplay/AnalogMadness-realistic-model-v7")
299
  #gr.load("stabilityai/stable-diffusion-3-medium-diffusers")
300
+ def query(prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
301
+ if prompt == "" or prompt == None:
302
+ return None
303
+ # Prepare the payload for the API call, including width and height
304
+ payload = {
305
+ "inputs": prompt,
306
+ "is_negative": is_negative,
307
+ "steps": steps,
308
+ "cfg_scale": cfg_scale,
309
+ "seed": seed if seed != -1 else random.randint(1, 1000000000),
310
+ "strength": strength,
311
+ "parameters": {
312
+ "width": width, # Pass the width to the API
313
+ "height": height # Pass the height to the API
314
+ }
315
+ }
316
+ model=("models/dvyio/flux-lora-film-noir")#base_model_id = "dvyio/flux-lora-film-noir"
317
+ with gr.Row(model):
318
+ text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2, elem_id="prompt-text-input")
319
 
320
+ with gr.Row(model):
321
+ with gr.Accordion("Advanced Settings", open=False):
322
+ negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="((((out of frame))), deformed, distorted, disfigured), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, misspellings, typos", lines=3, elem_id="negative-prompt-text-input")
323
+ with gr.Row(model):
324
+ width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=32)
325
+ height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=32)
326
+ steps = gr.Slider(label="Sampling steps", value=28, minimum=1, maximum=100, step=1)
327
+ cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
328
+ method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "DPM Fast" "Euler", "Euler a", "Euler+beta", "Heun", "DDIM", "PLMS", "UniPC"])
329
+ strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
330
+ seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
331
+ with gr.Row(model):
332
+ with gr.Accordion("Seed", open=False):
333
+ seed_output = gr.Textbox(label="Seed Used", show_copy_button = True, elem_id="seed-output")
334
+ with gr.Row(model):
335
+ text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
336
+ with gr.Row(model):
337
+ image_output = gr.Image(type="pil", label="Image Output", format="png", elem_id="gallery")
338
+ text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=[image_output, seed_output])
339
 
340
 
341
  with gr.Tab("Flip Image"):