Rooni commited on
Commit
064626b
1 Parent(s): 644742b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -22,14 +22,9 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
22
 
23
  API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN"), os.getenv("HF_READ_TOKEN_2"), os.getenv("HF_READ_TOKEN_3"), os.getenv("HF_READ_TOKEN_4"), os.getenv("HF_READ_TOKEN_5")]) # it is free
24
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
25
- language = detect(prompt)
26
  key = random.randint(0, 999)
27
 
28
  print(f'\033[1mГенерация {key}:\033[0m {prompt}')
29
- if language == 'ru':
30
- prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
31
- print(f'\033[1mГенерация {key} перевод:\033[0m {prompt}')
32
-
33
  if model == 'DALL-E 3 XL':
34
  API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
35
  if model == 'Playground 2':
@@ -62,7 +57,7 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
62
  API_URL = "https://api-inference.huggingface.co/models/DoctorDiffusion/doctor-diffusion-s-controllable-vector-art-xl-lora"
63
  if model == 'Disney':
64
  API_URL = "https://api-inference.huggingface.co/models/goofyai/disney_style_xl"
65
- prompt = f"Disney стиль. {prompt}"
66
  if model == 'CleanLinearMix':
67
  API_URL = "https://api-inference.huggingface.co/models/digiplay/CleanLinearMix_nsfw"
68
  if model == 'OrangeMixs':
@@ -70,6 +65,13 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
70
 
71
  prompt = f"{prompt} | ультра детализация, ультра проработка, ультра качество, идеально."
72
 
 
 
 
 
 
 
 
73
  payload = {
74
  "inputs": prompt,
75
  "is_negative": is_negative,
 
22
 
23
  API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN"), os.getenv("HF_READ_TOKEN_2"), os.getenv("HF_READ_TOKEN_3"), os.getenv("HF_READ_TOKEN_4"), os.getenv("HF_READ_TOKEN_5")]) # it is free
24
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
 
25
  key = random.randint(0, 999)
26
 
27
  print(f'\033[1mГенерация {key}:\033[0m {prompt}')
 
 
 
 
28
  if model == 'DALL-E 3 XL':
29
  API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
30
  if model == 'Playground 2':
 
57
  API_URL = "https://api-inference.huggingface.co/models/DoctorDiffusion/doctor-diffusion-s-controllable-vector-art-xl-lora"
58
  if model == 'Disney':
59
  API_URL = "https://api-inference.huggingface.co/models/goofyai/disney_style_xl"
60
+ prompt = f"Стиль Disney. {prompt}"
61
  if model == 'CleanLinearMix':
62
  API_URL = "https://api-inference.huggingface.co/models/digiplay/CleanLinearMix_nsfw"
63
  if model == 'OrangeMixs':
 
65
 
66
  prompt = f"{prompt} | ультра детализация, ультра проработка, ультра качество, идеально."
67
 
68
+ language = detect(prompt)
69
+
70
+ if language == 'ru':
71
+ prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
72
+ print(f'\033[1mГенерация {key} перевод:\033[0m {prompt}')
73
+
74
+
75
  payload = {
76
  "inputs": prompt,
77
  "is_negative": is_negative,