phenomenon1981
commited on
Commit
•
1b2ae47
1
Parent(s):
e256de8
Update app.py
Browse files
app.py
CHANGED
@@ -51,23 +51,6 @@ def get_prompts(prompt_text):
|
|
51 |
|
52 |
def inference(model_name, prompt, guidance, steps, n_images=1, width=512, height=512, seed=0, img=None, strength=0.5, neg_prompt=""):
|
53 |
|
54 |
-
print(psutil.virtual_memory()) # print memory usage
|
55 |
-
|
56 |
-
global current_model
|
57 |
-
for model in models:
|
58 |
-
if model.name == model_name:
|
59 |
-
current_model = model
|
60 |
-
model_path = current_model.path
|
61 |
-
|
62 |
-
generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
|
63 |
-
|
64 |
-
try:
|
65 |
-
if img is not None:
|
66 |
-
return img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator), None
|
67 |
-
else:
|
68 |
-
return txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator), None
|
69 |
-
except Exception as e:
|
70 |
-
return None, error_str(e)
|
71 |
|
72 |
with gr.Blocks() as myface:
|
73 |
with gr.Row():
|
|
|
51 |
|
52 |
def inference(model_name, prompt, guidance, steps, n_images=1, width=512, height=512, seed=0, img=None, strength=0.5, neg_prompt=""):
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
with gr.Blocks() as myface:
|
56 |
with gr.Row():
|