Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -2,7 +2,7 @@ import gradio as gr | |
| 2 | 
             
            import random
         | 
| 3 | 
             
            import os
         | 
| 4 |  | 
| 5 | 
            -
             | 
| 6 | 
             
            models = {
         | 
| 7 | 
             
                "Face Projection": gr.load("models/Purz/face-projection"),
         | 
| 8 | 
             
                "Flux LoRA Uncensored": gr.load("models/prashanth970/flux-lora-uncensored"),
         | 
| @@ -10,35 +10,19 @@ models = { | |
| 10 | 
             
                "NSFW Master": gr.load("models/pimpilikipilapi1/NSFW_master")
         | 
| 11 | 
             
            }
         | 
| 12 |  | 
| 13 | 
            -
            def generate_image(text,  | 
| 14 | 
            -
                if seed is not None:
         | 
| 15 | 
            -
                    random.seed(seed)
         | 
| 16 | 
            -
             | 
| 17 | 
             
                result_images = {}
         | 
| 18 | 
             
                for model_name, model in models.items():
         | 
| 19 | 
             
                    result_images[model_name] = model(text)
         | 
| 20 |  | 
| 21 | 
            -
                print(f" | 
| 22 |  | 
| 23 | 
             
                return [result_images[model_name] for model_name in models]
         | 
| 24 |  | 
| 25 | 
            -
            def randomize_parameters():
         | 
| 26 | 
            -
                seed = random.randint(0, 999999)
         | 
| 27 | 
            -
                width = random.randint(512, 2048)
         | 
| 28 | 
            -
                height = random.randint(512, 2048)
         | 
| 29 | 
            -
                guidance_scale = round(random.uniform(0.1, 20.0), 1)
         | 
| 30 | 
            -
                num_inference_steps = random.randint(1, 40)
         | 
| 31 | 
            -
                
         | 
| 32 | 
            -
                return seed, width, height, guidance_scale, num_inference_steps
         | 
| 33 | 
            -
             | 
| 34 | 
             
            interface = gr.Interface(
         | 
| 35 | 
             
                fn=generate_image,
         | 
| 36 | 
             
                inputs=[
         | 
| 37 | 
             
                    gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
         | 
| 38 | 
            -
                    gr.Slider(label="Seed", minimum=0, maximum=999999, step=1),
         | 
| 39 | 
            -
                    gr.Slider(label="Width", minimum=512, maximum=2048, step=64, value=1024),
         | 
| 40 | 
            -
                    gr.Slider(label="Height", minimum=512, maximum=2048, step=64, value=1024),
         | 
| 41 | 
            -
                    gr.Slider(label="Guidance Scale", minimum=0.1, maximum=20.0, step=0.1, value=3.0),
         | 
| 42 | 
             
                    gr.Slider(label="Number of inference steps", minimum=1, maximum=40, step=1, value=28),
         | 
| 43 | 
             
                ],
         | 
| 44 | 
             
                outputs=[gr.Image(label=model_name) for model_name in models],
         | 
|  | |
| 2 | 
             
            import random
         | 
| 3 | 
             
            import os
         | 
| 4 |  | 
| 5 | 
            +
             | 
| 6 | 
             
            models = {
         | 
| 7 | 
             
                "Face Projection": gr.load("models/Purz/face-projection"),
         | 
| 8 | 
             
                "Flux LoRA Uncensored": gr.load("models/prashanth970/flux-lora-uncensored"),
         | 
|  | |
| 10 | 
             
                "NSFW Master": gr.load("models/pimpilikipilapi1/NSFW_master")
         | 
| 11 | 
             
            }
         | 
| 12 |  | 
| 13 | 
            +
            def generate_image(text, num_inference_steps):
         | 
|  | |
|  | |
|  | |
| 14 | 
             
                result_images = {}
         | 
| 15 | 
             
                for model_name, model in models.items():
         | 
| 16 | 
             
                    result_images[model_name] = model(text)
         | 
| 17 |  | 
| 18 | 
            +
                print(f"Inference Steps: {num_inference_steps}")
         | 
| 19 |  | 
| 20 | 
             
                return [result_images[model_name] for model_name in models]
         | 
| 21 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 22 | 
             
            interface = gr.Interface(
         | 
| 23 | 
             
                fn=generate_image,
         | 
| 24 | 
             
                inputs=[
         | 
| 25 | 
             
                    gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
         | 
|  | |
|  | |
|  | |
|  | |
| 26 | 
             
                    gr.Slider(label="Number of inference steps", minimum=1, maximum=40, step=1, value=28),
         | 
| 27 | 
             
                ],
         | 
| 28 | 
             
                outputs=[gr.Image(label=model_name) for model_name in models],
         | 
