Spaces:
Runtime error
Runtime error
app.py
CHANGED
|
@@ -10,6 +10,12 @@ from datetime import datetime
|
|
| 10 |
from pytz import timezone
|
| 11 |
from scripts.survey import handle_form_submission, handle_visit_choice, handle_proceed, localize, script, generate_image, send_feedback
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
def process_image(input_image, mode, weight1=None, weight2=None):
|
| 14 |
tokyo_time = datetime.now(timezone('Asia/Tokyo')).strftime("%Y-%m-%d %H:%M:%S") # 日本時間のタイムスタンプ
|
| 15 |
print(f"[{tokyo_time}] Processing image with mode={mode}, weight1={weight1}, weight2={weight2}")
|
|
@@ -205,11 +211,6 @@ with gr.Blocks() as demo:
|
|
| 205 |
)
|
| 206 |
|
| 207 |
# JavaScriptの読み込み
|
| 208 |
-
demo.load(
|
| 209 |
-
|
| 210 |
-
# 初期化
|
| 211 |
-
initialize(_use_local=False, use_gpu=True, use_dotenv=True)
|
| 212 |
-
init_model(use_local=False)
|
| 213 |
-
load_wd14_tagger_model()
|
| 214 |
|
| 215 |
demo.launch()
|
|
|
|
| 10 |
from pytz import timezone
|
| 11 |
from scripts.survey import handle_form_submission, handle_visit_choice, handle_proceed, localize, script, generate_image, send_feedback
|
| 12 |
|
| 13 |
+
def initialize_models():
|
| 14 |
+
# 初期化
|
| 15 |
+
initialize(_use_local=False, use_gpu=True, use_dotenv=True)
|
| 16 |
+
init_model(use_local=False)
|
| 17 |
+
load_wd14_tagger_model()
|
| 18 |
+
|
| 19 |
def process_image(input_image, mode, weight1=None, weight2=None):
|
| 20 |
tokyo_time = datetime.now(timezone('Asia/Tokyo')).strftime("%Y-%m-%d %H:%M:%S") # 日本時間のタイムスタンプ
|
| 21 |
print(f"[{tokyo_time}] Processing image with mode={mode}, weight1={weight1}, weight2={weight2}")
|
|
|
|
| 211 |
)
|
| 212 |
|
| 213 |
# JavaScriptの読み込み
|
| 214 |
+
demo.load(fn=initialize_models, js=script)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
demo.launch()
|