Spaces:
Runtime error
Runtime error
macadeliccc
commited on
Commit
·
5376cf0
1
Parent(s):
79bace9
test
Browse files- app.py +3 -2
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from diffusers import StableDiffusionXLPipeline
|
2 |
from pydantic import BaseModel
|
3 |
from PIL import Image
|
@@ -6,7 +7,7 @@ import torch
|
|
6 |
import uuid
|
7 |
import io
|
8 |
import os
|
9 |
-
|
10 |
|
11 |
# Load your model
|
12 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
@@ -28,7 +29,7 @@ def generate_and_save_image(prompt, negative_prompt=''):
|
|
28 |
|
29 |
# Save generated image locally
|
30 |
os.makedirs('generated_images', exist_ok=True)
|
31 |
-
image.save(image_path, format='
|
32 |
|
33 |
# Return the path of the saved image to display in Gradio interface
|
34 |
return image_path
|
|
|
1 |
+
import spaces
|
2 |
from diffusers import StableDiffusionXLPipeline
|
3 |
from pydantic import BaseModel
|
4 |
from PIL import Image
|
|
|
7 |
import uuid
|
8 |
import io
|
9 |
import os
|
10 |
+
|
11 |
|
12 |
# Load your model
|
13 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
|
29 |
|
30 |
# Save generated image locally
|
31 |
os.makedirs('generated_images', exist_ok=True)
|
32 |
+
image.save(image_path, format='jpeg/jpg')
|
33 |
|
34 |
# Return the path of the saved image to display in Gradio interface
|
35 |
return image_path
|
requirements.txt
CHANGED
@@ -5,4 +5,5 @@ torch
|
|
5 |
uuid
|
6 |
pydantic
|
7 |
Pillow
|
8 |
-
accelerate
|
|
|
|
5 |
uuid
|
6 |
pydantic
|
7 |
Pillow
|
8 |
+
accelerate
|
9 |
+
spaces
|