Update app.py
Browse files
app.py
CHANGED
@@ -6,19 +6,14 @@ import os
|
|
6 |
from PIL import Image
|
7 |
from deep_translator import GoogleTranslator
|
8 |
from langdetect import detect
|
9 |
-
import json
|
10 |
|
11 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
|
12 |
-
API_TOKEN = os.getenv("HF_READ_TOKEN")
|
13 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
14 |
-
|
15 |
models_list = ["AbsoluteReality 1.8.1", "DALL-E 3 XL", "Playground 2", "Openjourney 4", "Lyriel 1.6", "Animagine XL 2.0", "Counterfeit 2.5", "Realistic Vision 5.1", "Incursios 1.6", "Anime Detailer XL", "Vector Art XL", "epiCRealism", "PixelArt XL", "NewReality XL", "Anything 5.0", "PixArt XL 2.0", "Disney Cartoon", "CleanLinearMix", "Waifu 1.4"]
|
16 |
|
17 |
def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, seed=None, sampler="DPM++ 2M Karras"):
|
18 |
-
if prompt == None:
|
19 |
-
return None
|
20 |
-
|
21 |
-
API_TOKEN = random.choice(keys_list)
|
22 |
language = detect(prompt)
|
23 |
key = random.randint(0, 999)
|
24 |
|
|
|
6 |
from PIL import Image
|
7 |
from deep_translator import GoogleTranslator
|
8 |
from langdetect import detect
|
|
|
9 |
|
10 |
API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
|
11 |
+
API_TOKEN = os.getenv("HF_READ_TOKEN") # it is free
|
12 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
13 |
+
|
14 |
models_list = ["AbsoluteReality 1.8.1", "DALL-E 3 XL", "Playground 2", "Openjourney 4", "Lyriel 1.6", "Animagine XL 2.0", "Counterfeit 2.5", "Realistic Vision 5.1", "Incursios 1.6", "Anime Detailer XL", "Vector Art XL", "epiCRealism", "PixelArt XL", "NewReality XL", "Anything 5.0", "PixArt XL 2.0", "Disney Cartoon", "CleanLinearMix", "Waifu 1.4"]
|
15 |
|
16 |
def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, seed=None, sampler="DPM++ 2M Karras"):
|
|
|
|
|
|
|
|
|
17 |
language = detect(prompt)
|
18 |
key = random.randint(0, 999)
|
19 |
|