Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from random import randint
|
3 |
from all_models import models
|
4 |
-
import os
|
5 |
-
from PIL import Image
|
6 |
|
7 |
def load_fn(models):
|
8 |
global models_load
|
@@ -34,14 +32,7 @@ def gen_fn(model_str, prompt, negative_prompt=None, image_style="Default"):
|
|
34 |
modified_prompt = f"{prompt}, {image_style}"
|
35 |
if negative_prompt:
|
36 |
modified_prompt += f", not {negative_prompt}"
|
37 |
-
|
38 |
-
if image:
|
39 |
-
image_path = f"output/{model_str}_{randint(0, 10000)}.jpg"
|
40 |
-
if not os.path.exists('output'):
|
41 |
-
os.makedirs('output')
|
42 |
-
image.save(image_path, format="JPEG")
|
43 |
-
return image_path
|
44 |
-
return None
|
45 |
|
46 |
with gr.Blocks() as demo:
|
47 |
with gr.Tab('The Dream'):
|
@@ -90,4 +81,4 @@ with gr.Blocks() as demo:
|
|
90 |
"""
|
91 |
)
|
92 |
|
93 |
-
demo.launch(max_threads=200)
|
|
|
1 |
import gradio as gr
|
2 |
from random import randint
|
3 |
from all_models import models
|
|
|
|
|
4 |
|
5 |
def load_fn(models):
|
6 |
global models_load
|
|
|
32 |
modified_prompt = f"{prompt}, {image_style}"
|
33 |
if negative_prompt:
|
34 |
modified_prompt += f", not {negative_prompt}"
|
35 |
+
return models_load[model_str](modified_prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
with gr.Blocks() as demo:
|
38 |
with gr.Tab('The Dream'):
|
|
|
81 |
"""
|
82 |
)
|
83 |
|
84 |
+
demo.launch(max_threads=200)
|