File size: 1,784 Bytes
b26990a
 
fb90db2
b26990a
 
 
 
 
 
 
ad2dbbc
 
 
 
 
 
b26990a
1fb1fc0
075b28a
1fb1fc0
 
 
 
 
9131a83
 
1fb1fc0
 
b26990a
 
16a4dc4
 
 
 
 
1fb1fc0
 
 
 
 
 
 
c0a488d
 
 
 
 
 
1fb1fc0
c0a488d
 
 
 
 
 
 
c7a2391
1fb1fc0
 
 
 
b26990a
 
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import gradio as gr
import requests
import json
url = "https://api.prodia.com/v1/job"

headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "X-Prodia-Key": "69e66898-010d-4cd1-9e22-090f73ad007b"
}
models = [
    {"name": "Timeless", "url": "timeless-1.0.ckpt 1.0.ckpt [7c4971d4]"},
    {"name": "Dreamlike-diffusion-2.0.", "url": "dreamlike-diffusion-2.0.safetensors [fdcf65e7]"},
    {"name": "Deliberate_v2", "url": "deliberate_v2.safetensors [10ec4b29]"},
    {"name": "Anything-v4.5-pruned", "url": "anything-v4.5-pruned.ckpt [65745d25]"},
]

current_model = models[0]

models2 = []
for model in models:
    model_url = f"models/{model['url']}"
    loaded_model = gr.Interface.load(model_url, live=True, preprocess=True)
    models2.append(loaded_model)


def text_it(inputs, text_gen=text_gen):
    return text_gen(inputs)


def set_model(current_model_index):
    global current_model
    current_model = models[current_model_index]
    return gr.update(value=f"{current_model['name']}")


def send_it(inputs, model_choice):
    proc = models2[model_choice]
    return proc(inputs)


with gr.Blocks() as myface:
    gr.HTML(

    )

    with gr.Row():
        with gr.Row():
            input_text = gr.Textbox(label="Iput Prompt",  placeholder="", lines=1)
            # Model selection dropdown
            model_name1 = gr.Dropdown(
                label="Choose Model",
                choices=[m["name"] for m in models],
                type="index",
                value=current_model["name"],
                interactive=True,
            )
        with gr.Row():
            see_prompts = gr.Button("Generate Prompts")
            run = gr.Button("Generate Images", variant="primary")

if __name__ == "__main__":
    demo.launch()