Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -297,46 +297,9 @@ 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 |
-
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")
|
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 |
-
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
329 |
-
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
|
330 |
-
with gr.Row(model):
|
331 |
-
with gr.Accordion("Seed", open=False):
|
332 |
-
seed_output = gr.Textbox(label="Seed Used", show_copy_button = True, elem_id="seed-output")
|
333 |
-
with gr.Row(model):
|
334 |
-
text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
|
335 |
-
with gr.Row(model):
|
336 |
-
image_output = gr.Image(type="pil", label="Image Output", format="png", elem_id="gallery")
|
337 |
-
text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=[image_output, seed_output])
|
338 |
|
339 |
-
|
|
|
340 |
with gr.Tab("Flip Image"):
|
341 |
with gr.Row():
|
342 |
mage_input = gr.Image(type="numpy", label="Upload 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 |
|
301 |
+
model=gr.load("models/dvyio/flux-lora-film-noir")
|
302 |
+
|
303 |
with gr.Tab("Flip Image"):
|
304 |
with gr.Row():
|
305 |
mage_input = gr.Image(type="numpy", label="Upload Image")
|