Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|
| 15 |
from flask import Flask, request, jsonify, Response, stream_with_context
|
| 16 |
|
| 17 |
os.environ['TZ'] = 'Asia/Shanghai'
|
| 18 |
-
|
| 19 |
|
| 20 |
logging.basicConfig(level=logging.INFO,
|
| 21 |
format='%(asctime)s - %(levelname)s - %(message)s')
|
|
@@ -841,7 +841,6 @@ def handsome_images_generations():
|
|
| 841 |
response_data = {}
|
| 842 |
|
| 843 |
if "stable-diffusion" in model_name or model_name in ["black-forest-labs/FLUX.1-schnell", "Pro/black-forest-labs/FLUX.1-schnell","black-forest-labs/FLUX.1-dev", "black-forest-labs/FLUX.1-pro"]:
|
| 844 |
-
|
| 845 |
siliconflow_data = {
|
| 846 |
"model": model_name,
|
| 847 |
"prompt": data.get("prompt"),
|
|
@@ -876,7 +875,7 @@ def handsome_images_generations():
|
|
| 876 |
if siliconflow_data["interval"] < 1 or siliconflow_data["interval"] > 4 :
|
| 877 |
siliconflow_data["interval"] = 2
|
| 878 |
else:
|
| 879 |
-
siliconflow_data["image_size"] = data.get("image_size", "1024x1024")
|
| 880 |
siliconflow_data["prompt_enhancement"] = data.get("prompt_enhancement", False)
|
| 881 |
seed = data.get("seed")
|
| 882 |
if isinstance(seed, int) and 0 < seed < 9999999999:
|
|
@@ -961,7 +960,6 @@ def handsome_images_generations():
|
|
| 961 |
"data": []
|
| 962 |
}
|
| 963 |
|
| 964 |
-
|
| 965 |
logging.info(
|
| 966 |
f"使用的key: {api_key}, "
|
| 967 |
f"总共用时: {total_time:.4f}秒, "
|
|
@@ -1016,7 +1014,6 @@ def handsome_chat_completions():
|
|
| 1016 |
}
|
| 1017 |
|
| 1018 |
if model_name in image_models:
|
| 1019 |
-
# Handle image generation
|
| 1020 |
user_content = ""
|
| 1021 |
messages = data.get("messages", [])
|
| 1022 |
for message in messages:
|
|
|
|
| 15 |
from flask import Flask, request, jsonify, Response, stream_with_context
|
| 16 |
|
| 17 |
os.environ['TZ'] = 'Asia/Shanghai'
|
| 18 |
+
time.tzset()
|
| 19 |
|
| 20 |
logging.basicConfig(level=logging.INFO,
|
| 21 |
format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
|
| 841 |
response_data = {}
|
| 842 |
|
| 843 |
if "stable-diffusion" in model_name or model_name in ["black-forest-labs/FLUX.1-schnell", "Pro/black-forest-labs/FLUX.1-schnell","black-forest-labs/FLUX.1-dev", "black-forest-labs/FLUX.1-pro"]:
|
|
|
|
| 844 |
siliconflow_data = {
|
| 845 |
"model": model_name,
|
| 846 |
"prompt": data.get("prompt"),
|
|
|
|
| 875 |
if siliconflow_data["interval"] < 1 or siliconflow_data["interval"] > 4 :
|
| 876 |
siliconflow_data["interval"] = 2
|
| 877 |
else:
|
| 878 |
+
siliconflow_data["image_size"] = data.get("image_size", "1024x1024")
|
| 879 |
siliconflow_data["prompt_enhancement"] = data.get("prompt_enhancement", False)
|
| 880 |
seed = data.get("seed")
|
| 881 |
if isinstance(seed, int) and 0 < seed < 9999999999:
|
|
|
|
| 960 |
"data": []
|
| 961 |
}
|
| 962 |
|
|
|
|
| 963 |
logging.info(
|
| 964 |
f"使用的key: {api_key}, "
|
| 965 |
f"总共用时: {total_time:.4f}秒, "
|
|
|
|
| 1014 |
}
|
| 1015 |
|
| 1016 |
if model_name in image_models:
|
|
|
|
| 1017 |
user_content = ""
|
| 1018 |
messages = data.get("messages", [])
|
| 1019 |
for message in messages:
|