alfredplpl
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import gradio as gr
|
|
5 |
import torch
|
6 |
from PIL import Image
|
7 |
import random
|
|
|
8 |
|
9 |
import requests
|
10 |
|
@@ -142,7 +143,8 @@ def auto_prompt_correction(prompt_ui,neg_prompt_ui,cool_japan_type_ui,disable_au
|
|
142 |
neg_prompt=f"(((deformed))), {neg_prompt}, girl, boy, photo, people, low quality, ui, error, lowres, jpeg artifacts, 2d, 3d, cg, text"
|
143 |
|
144 |
return prompt,neg_prompt
|
145 |
-
|
|
|
146 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator,superreso=False):
|
147 |
global pipe, upscaler
|
148 |
if(superreso):
|
@@ -179,6 +181,7 @@ def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator,sup
|
|
179 |
|
180 |
return result.images[0]
|
181 |
|
|
|
182 |
def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height, generator,superreso=False):
|
183 |
ratio = min(height / img.height, width / img.width)
|
184 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
|
|
5 |
import torch
|
6 |
from PIL import Image
|
7 |
import random
|
8 |
+
import spaces
|
9 |
|
10 |
import requests
|
11 |
|
|
|
143 |
neg_prompt=f"(((deformed))), {neg_prompt}, girl, boy, photo, people, low quality, ui, error, lowres, jpeg artifacts, 2d, 3d, cg, text"
|
144 |
|
145 |
return prompt,neg_prompt
|
146 |
+
|
147 |
+
@spaces.GPU
|
148 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator,superreso=False):
|
149 |
global pipe, upscaler
|
150 |
if(superreso):
|
|
|
181 |
|
182 |
return result.images[0]
|
183 |
|
184 |
+
@spaces.GPU
|
185 |
def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height, generator,superreso=False):
|
186 |
ratio = min(height / img.height, width / img.width)
|
187 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|