Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ import matplotlib.pyplot as plt
|
|
10 |
import numpy as np
|
11 |
import PIL
|
12 |
|
13 |
-
|
14 |
|
15 |
model = whisper.load_model("base")
|
16 |
model.device
|
@@ -18,7 +18,7 @@ model.device
|
|
18 |
model_id = 'prompthero/midjourney-v4-diffusion' #"stabilityai/stable-diffusion-2"
|
19 |
|
20 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
21 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id) #pipe = StableDiffusionPipeline.from_pretrained(model_id , torch_dtype=torch.float16 #pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16)
|
22 |
pipe = pipe.to("cuda")
|
23 |
|
24 |
def transcribe(audio,prompt_num,user_keywords):
|
@@ -175,11 +175,12 @@ def keywords(text,prompt_num,user_keywords):
|
|
175 |
count += 1
|
176 |
print(i)
|
177 |
print("works4")
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
183 |
|
184 |
# min_shape = sorted( [(np.sum(i.size), i.size ) for i in images])[0][1]
|
185 |
# imgs_comb = np.hstack([i.resize(min_shape) for i in images])
|
|
|
10 |
import numpy as np
|
11 |
import PIL
|
12 |
|
13 |
+
|
14 |
|
15 |
model = whisper.load_model("base")
|
16 |
model.device
|
|
|
18 |
model_id = 'prompthero/midjourney-v4-diffusion' #"stabilityai/stable-diffusion-2"
|
19 |
|
20 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
21 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.torch.cuda.empty_cache()16) #pipe = StableDiffusionPipeline.from_pretrained(model_id , torch_dtype=torch.float16 #pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16)
|
22 |
pipe = pipe.to("cuda")
|
23 |
|
24 |
def transcribe(audio,prompt_num,user_keywords):
|
|
|
175 |
count += 1
|
176 |
print(i)
|
177 |
print("works4")
|
178 |
+
torch.cuda.empty_cache()
|
179 |
+
with torch.autocast("cuda"):
|
180 |
+
image = pipe(i, height=768, width=768, guidance_scale = 10).images[0]
|
181 |
+
print("works5")
|
182 |
+
images.append(image)
|
183 |
+
print("works6")
|
184 |
|
185 |
# min_shape = sorted( [(np.sum(i.size), i.size ) for i in images])[0][1]
|
186 |
# imgs_comb = np.hstack([i.resize(min_shape) for i in images])
|