Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,19 @@ models = [
|
|
7 |
|
8 |
current_model = models[0]
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
def flip_text(x):
|
11 |
return x[::-1]
|
12 |
|
|
|
|
|
|
|
|
|
13 |
|
14 |
def flip_image(x):
|
15 |
return np.fliplr(x)
|
@@ -38,6 +48,14 @@ with gr.Blocks() as pan:
|
|
38 |
)
|
39 |
input_text = gr.Textbox(label="Prompt idea",)
|
40 |
output1 = gr.Image(label="")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
with gr.Tab("Flip Image"):
|
43 |
with gr.Row():
|
|
|
7 |
|
8 |
current_model = models[0]
|
9 |
|
10 |
+
models2 = []
|
11 |
+
for model in models:
|
12 |
+
model_url = f"models/{model['url']}"
|
13 |
+
loaded_model = gr.Interface.load(model_url, live=True, preprocess=True)
|
14 |
+
models2.append(loaded_model)
|
15 |
+
|
16 |
def flip_text(x):
|
17 |
return x[::-1]
|
18 |
|
19 |
+
def send_it(inputs, model_choice):
|
20 |
+
proc = models2[model_choice]
|
21 |
+
return proc(inputs)
|
22 |
+
|
23 |
|
24 |
def flip_image(x):
|
25 |
return np.fliplr(x)
|
|
|
48 |
)
|
49 |
input_text = gr.Textbox(label="Prompt idea",)
|
50 |
output1 = gr.Image(label="")
|
51 |
+
output2 = gr.Image(label="")
|
52 |
+
magic1 = gr.Textbox(label="Generated Prompt", lines=2)
|
53 |
+
magic2 = gr.Textbox(label="Generated Prompt", lines=2)
|
54 |
+
|
55 |
+
run.click(send_it, inputs=[magic1, model_name1], outputs=[output1])
|
56 |
+
run.click(send_it, inputs=[magic2, model_name1], outputs=[output2])
|
57 |
+
|
58 |
+
model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2,])
|
59 |
|
60 |
with gr.Tab("Flip Image"):
|
61 |
with gr.Row():
|