File size: 1,986 Bytes
17e58be
190c4ad
 
77efc8c
190c4ad
0389d06
190c4ad
 
 
 
0389d06
77efc8c
190c4ad
 
 
25cb0a6
190c4ad
 
 
77efc8c
190c4ad
 
 
 
 
 
 
 
 
 
 
 
25cb0a6
0389d06
 
 
190c4ad
 
 
 
 
 
0389d06
190c4ad
25cb0a6
0389d06
 
146f57d
190c4ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import gradio as gr
import random
import os

# Load all models
models = {
    "Face Projection": gr.load("models/Purz/face-projection"),
    "Flux LoRA Uncensored": gr.load("models/prashanth970/flux-lora-uncensored"),
    "NSFW TrioHMH Flux": gr.load("models/DiegoJR1973/NSFW-TrioHMH-Flux"),
    "NSFW Master": gr.load("models/pimpilikipilapi1/NSFW_master")
}

def generate_image(text, seed, width, height, guidance_scale, num_inference_steps):
    if seed is not None:
        random.seed(seed)

    result_images = {}
    for model_name, model in models.items():
        result_images[model_name] = model(text)

    print(f"Width: {width}, Height: {height}, Guidance Scale: {guidance_scale}, Inference Steps: {num_inference_steps}")
    
    return [result_images[model_name] for model_name in models]

def randomize_parameters():
    seed = random.randint(0, 999999)
    width = random.randint(512, 2048)
    height = random.randint(512, 2048)
    guidance_scale = round(random.uniform(0.1, 20.0), 1)
    num_inference_steps = random.randint(1, 40)
    
    return seed, width, height, guidance_scale, num_inference_steps

interface = gr.Interface(
    fn=generate_image,
    inputs=[
        gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
        gr.Slider(label="Seed", minimum=0, maximum=999999, step=1),
        gr.Slider(label="Width", minimum=512, maximum=2048, step=64, value=1024),
        gr.Slider(label="Height", minimum=512, maximum=2048, step=64, value=1024),
        gr.Slider(label="Guidance Scale", minimum=0.1, maximum=20.0, step=0.1, value=3.0),
        gr.Slider(label="Number of inference steps", minimum=1, maximum=40, step=1, value=28),
    ],
    outputs=[gr.Image(label=model_name) for model_name in models],
    theme="NoCrypt/miku",
    description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
)

interface.launch()