Update app.py
Browse files
app.py
CHANGED
@@ -15,34 +15,38 @@ models = [
|
|
15 |
{"name": "Anything-v4.5-pruned", "url": "anything-v4.5-pruned.ckpt [65745d25]"},
|
16 |
]
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
-
print(response.text)
|
24 |
|
25 |
-
|
|
|
26 |
|
27 |
-
#generator = DiffusionPipeline.from_pretrained("CompVis/ldm-text2im-large-256")
|
28 |
-
|
29 |
-
def generate(prompts):
|
30 |
-
images = generator(list(prompts)).images
|
31 |
-
return [images]
|
32 |
|
33 |
def set_model(current_model_index):
|
34 |
global current_model
|
35 |
current_model = models[current_model_index]
|
36 |
return gr.update(value=f"{current_model['name']}")
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
gr.HTML(
|
40 |
|
41 |
)
|
42 |
|
43 |
with gr.Row():
|
44 |
with gr.Row():
|
45 |
-
input_text = gr.Textbox(label="
|
46 |
# Model selection dropdown
|
47 |
model_name1 = gr.Dropdown(
|
48 |
label="Choose Model",
|
@@ -51,5 +55,9 @@ with gr.Blocks() as demo:
|
|
51 |
value=current_model["name"],
|
52 |
interactive=True,
|
53 |
)
|
|
|
|
|
|
|
|
|
54 |
if __name__ == "__main__":
|
55 |
demo.launch()
|
|
|
15 |
{"name": "Anything-v4.5-pruned", "url": "anything-v4.5-pruned.ckpt [65745d25]"},
|
16 |
]
|
17 |
|
18 |
+
current_model = models[0]
|
19 |
|
20 |
+
models2 = []
|
21 |
+
for model in models:
|
22 |
+
model_url = f"models/{model['url']}"
|
23 |
+
loaded_model = gr.Interface.load(model_url, live=True, preprocess=True)
|
24 |
+
models2.append(loaded_model)
|
25 |
|
|
|
26 |
|
27 |
+
def text_it(inputs, text_gen=text_gen):
|
28 |
+
return text_gen(inputs)
|
29 |
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
def set_model(current_model_index):
|
32 |
global current_model
|
33 |
current_model = models[current_model_index]
|
34 |
return gr.update(value=f"{current_model['name']}")
|
35 |
|
36 |
+
|
37 |
+
def send_it(inputs, model_choice):
|
38 |
+
proc = models2[model_choice]
|
39 |
+
return proc(inputs)
|
40 |
+
|
41 |
+
|
42 |
+
with gr.Blocks() as myface:
|
43 |
gr.HTML(
|
44 |
|
45 |
)
|
46 |
|
47 |
with gr.Row():
|
48 |
with gr.Row():
|
49 |
+
input_text = gr.Textbox(label="Iput Prompt", placeholder="", lines=1)
|
50 |
# Model selection dropdown
|
51 |
model_name1 = gr.Dropdown(
|
52 |
label="Choose Model",
|
|
|
55 |
value=current_model["name"],
|
56 |
interactive=True,
|
57 |
)
|
58 |
+
with gr.Row():
|
59 |
+
see_prompts = gr.Button("Generate Prompts")
|
60 |
+
run = gr.Button("Generate Images", variant="primary")
|
61 |
+
|
62 |
if __name__ == "__main__":
|
63 |
demo.launch()
|