Spaces:
Running
Running
ngoctuanai
commited on
Commit
•
72aa445
1
Parent(s):
5915fb7
Update app.py
Browse files
app.py
CHANGED
@@ -7,38 +7,38 @@ from PIL import Image
|
|
7 |
|
8 |
# List of available models
|
9 |
list_models = [
|
10 |
-
"SDXL
|
11 |
-
"Disney
|
12 |
-
"Midjourney
|
13 |
-
"Segmind
|
14 |
]
|
15 |
|
16 |
# Function to generate images from text
|
17 |
def generate_txt2img(current_model, prompt, is_negative=False, image_style="None style", steps=50, cfg_scale=7, seed=None):
|
18 |
|
19 |
-
if current_model == "SD
|
20 |
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
|
21 |
-
elif current_model == "SDXL
|
22 |
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
|
23 |
elif current_model == "OpenJourney":
|
24 |
API_URL = "https://api-inference.huggingface.co/models/prompthero/openjourney"
|
25 |
-
elif current_model == "Anything
|
26 |
API_URL = "https://api-inference.huggingface.co/models/xyn-ai/anything-v4.0"
|
27 |
-
elif current_model == "Disney
|
28 |
API_URL = "https://api-inference.huggingface.co/models/stablediffusionapi/disney-pixar-cartoon"
|
29 |
-
elif current_model == "Pixel
|
30 |
API_URL = "https://api-inference.huggingface.co/models/nerijs/pixel-art-xl"
|
31 |
-
elif current_model == "Dalle
|
32 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
|
33 |
-
elif current_model == "Midjourney
|
34 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/midjourney-v4-xl"
|
35 |
-
elif current_model == "Open
|
36 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/open-diffusion-v1"
|
37 |
-
elif current_model == "SSD
|
38 |
API_URL = "https://api-inference.huggingface.co/models/segmind/SSD-1B"
|
39 |
-
elif current_model == "Segmind
|
40 |
API_URL = "https://api-inference.huggingface.co/models/segmind/Segmind-Vega"
|
41 |
-
elif current_model == "Animagine
|
42 |
API_URL = "https://api-inference.huggingface.co/models/Linaqruf/animagine-xl-2.0"
|
43 |
|
44 |
API_TOKEN = os.environ.get("HF_READ_TOKEN")
|
|
|
7 |
|
8 |
# List of available models
|
9 |
list_models = [
|
10 |
+
"SDXL 1.0", "SD 1.5", "OpenJourney", "Anything V4.0",
|
11 |
+
"Disney Pixar Cartoon", "Pixel Art XL", "Dalle 3 XL",
|
12 |
+
"Midjourney V4 XL", "Open Diffusion V1", "SSD 1B",
|
13 |
+
"Segmind Vega", "Animagine XL-2.0",
|
14 |
]
|
15 |
|
16 |
# Function to generate images from text
|
17 |
def generate_txt2img(current_model, prompt, is_negative=False, image_style="None style", steps=50, cfg_scale=7, seed=None):
|
18 |
|
19 |
+
if current_model == "SD 1.5":
|
20 |
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
|
21 |
+
elif current_model == "SDXL 1.0":
|
22 |
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
|
23 |
elif current_model == "OpenJourney":
|
24 |
API_URL = "https://api-inference.huggingface.co/models/prompthero/openjourney"
|
25 |
+
elif current_model == "Anything V4.0":
|
26 |
API_URL = "https://api-inference.huggingface.co/models/xyn-ai/anything-v4.0"
|
27 |
+
elif current_model == "Disney Pixar Cartoon":
|
28 |
API_URL = "https://api-inference.huggingface.co/models/stablediffusionapi/disney-pixar-cartoon"
|
29 |
+
elif current_model == "Pixel Art XL":
|
30 |
API_URL = "https://api-inference.huggingface.co/models/nerijs/pixel-art-xl"
|
31 |
+
elif current_model == "Dalle 3 XL":
|
32 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
|
33 |
+
elif current_model == "Midjourney V4 XL":
|
34 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/midjourney-v4-xl"
|
35 |
+
elif current_model == "Open Diffusion V1":
|
36 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/open-diffusion-v1"
|
37 |
+
elif current_model == "SSD 1B":
|
38 |
API_URL = "https://api-inference.huggingface.co/models/segmind/SSD-1B"
|
39 |
+
elif current_model == "Segmind Vega":
|
40 |
API_URL = "https://api-inference.huggingface.co/models/segmind/Segmind-Vega"
|
41 |
+
elif current_model == "Animagine XL-2.0":
|
42 |
API_URL = "https://api-inference.huggingface.co/models/Linaqruf/animagine-xl-2.0"
|
43 |
|
44 |
API_TOKEN = os.environ.get("HF_READ_TOKEN")
|