Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,8 +9,6 @@ from deep_translator import GoogleTranslator
|
|
| 9 |
app = Flask(__name__)
|
| 10 |
|
| 11 |
API_URL = "https://api-inference.huggingface.co/models/dreamlike-art/dreamlike-anime-1.0"
|
| 12 |
-
API_TOKEN = os.getenv("HF_READ_TOKEN")
|
| 13 |
-
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 14 |
timeout = 50000 # タイムアウトを300秒に設定
|
| 15 |
|
| 16 |
# Function to query the API and return the generated image
|
|
@@ -43,7 +41,7 @@ def query(prompt, negative_prompt="", steps=35, cfg_scale=7, sampler="DPM++ 2M K
|
|
| 43 |
|
| 44 |
for attempt in range(3): # 最大3回の再試行
|
| 45 |
try:
|
| 46 |
-
response = requests.post(API_URL,
|
| 47 |
if response.status_code != 200:
|
| 48 |
return None, f"Error: Failed to get image. Status code: {response.status_code}, Details: {response.text}"
|
| 49 |
|
|
|
|
| 9 |
app = Flask(__name__)
|
| 10 |
|
| 11 |
API_URL = "https://api-inference.huggingface.co/models/dreamlike-art/dreamlike-anime-1.0"
|
|
|
|
|
|
|
| 12 |
timeout = 50000 # タイムアウトを300秒に設定
|
| 13 |
|
| 14 |
# Function to query the API and return the generated image
|
|
|
|
| 41 |
|
| 42 |
for attempt in range(3): # 最大3回の再試行
|
| 43 |
try:
|
| 44 |
+
response = requests.post(API_URL, json=payload, timeout=timeout)
|
| 45 |
if response.status_code != 200:
|
| 46 |
return None, f"Error: Failed to get image. Status code: {response.status_code}, Details: {response.text}"
|
| 47 |
|