Rooni commited on
Commit
b3ccc3e
·
1 Parent(s): 50a15a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -27,6 +27,7 @@ mmodels = {
27
  "CleanLinearMix": "https://api-inference.huggingface.co/models/digiplay/CleanLinearMix_nsfw",
28
  "Redmond SDXL": "https://api-inference.huggingface.co/models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2"
29
  }
 
30
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
31
  timeout = 100
32
  # PLEASE ❤ like ❤ this space. Please like me. I am 12 years old, one of my projects is: https://ai-hub.rf.gd . I live in Russia, I don't know English very well. Therefore, I apologize that there is only Russian here, but I think it will not be difficult to translate all this. (For example, using gpt)
@@ -53,7 +54,7 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
53
  "max_tokens": 4095,
54
  }
55
 
56
-
57
  # API ключ для OpenAI
58
  api_key_oi = os.getenv("API_KEY_OPENAI")
59
 
@@ -81,11 +82,10 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
81
  else:
82
  # Если произошла ошибка, возвращаем сообщение об ошибке
83
  print(f"Error: {response.status_code} - {response.text}")
84
-
85
-
86
- 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
87
- headers = {"Authorization": f"Bearer {API_TOKEN}"}
88
-
89
  prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
90
  print(f'\033[1mГенерация {key} перевод:\033[0m {prompt}')
91
 
 
27
  "CleanLinearMix": "https://api-inference.huggingface.co/models/digiplay/CleanLinearMix_nsfw",
28
  "Redmond SDXL": "https://api-inference.huggingface.co/models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2"
29
  }
30
+ API_TOKEN = os.getenv("HF_READ_TOKEN")
31
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
32
  timeout = 100
33
  # PLEASE ❤ like ❤ this space. Please like me. I am 12 years old, one of my projects is: https://ai-hub.rf.gd . I live in Russia, I don't know English very well. Therefore, I apologize that there is only Russian here, but I think it will not be difficult to translate all this. (For example, using gpt)
 
54
  "max_tokens": 4095,
55
  }
56
 
57
+
58
  # API ключ для OpenAI
59
  api_key_oi = os.getenv("API_KEY_OPENAI")
60
 
 
82
  else:
83
  # Если произошла ошибка, возвращаем сообщение об ошибке
84
  print(f"Error: {response.status_code} - {response.text}")
85
+ 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")])
86
+ headers = {
87
+ 'Authorization': f'Bearer {API_TOKEN}'
88
+ }
 
89
  prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
90
  print(f'\033[1mГенерация {key} перевод:\033[0m {prompt}')
91