Spaces:
Runtime error
Runtime error
app.pyのサンプルファイルのディレクトリを絶対パスに解決し、`gr.Examples`の存在チェックを追加しました。
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ import shutil
|
|
5 |
from pathlib import Path
|
6 |
from model_manager import ModelManager
|
7 |
|
8 |
-
#
|
9 |
-
EXAMPLES_DIR = Path(__file__).parent / "example"
|
10 |
|
11 |
# インポートエラーのデバッグ情報を表示
|
12 |
try:
|
@@ -123,15 +123,19 @@ with gr.Blocks(title="DittoTalkingHead") as demo:
|
|
123 |
)
|
124 |
|
125 |
# サンプル
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
|
136 |
# イベントハンドラ
|
137 |
generate_btn.click(
|
|
|
5 |
from pathlib import Path
|
6 |
from model_manager import ModelManager
|
7 |
|
8 |
+
# サンプルファイルのディレクトリを定義(絶対パスに解決)
|
9 |
+
EXAMPLES_DIR = (Path(__file__).parent / "example").resolve()
|
10 |
|
11 |
# インポートエラーのデバッグ情報を表示
|
12 |
try:
|
|
|
123 |
)
|
124 |
|
125 |
# サンプル
|
126 |
+
example_audio = EXAMPLES_DIR / "audio.wav"
|
127 |
+
example_image = EXAMPLES_DIR / "image.png"
|
128 |
+
|
129 |
+
if example_audio.exists() and example_image.exists():
|
130 |
+
gr.Examples(
|
131 |
+
examples=[
|
132 |
+
[str(example_audio), str(example_image)]
|
133 |
+
],
|
134 |
+
inputs=[audio_input, image_input],
|
135 |
+
outputs=[video_output, status_output],
|
136 |
+
fn=process_talking_head,
|
137 |
+
cache_examples=True
|
138 |
+
)
|
139 |
|
140 |
# イベントハンドラ
|
141 |
generate_btn.click(
|