visualizingjp commited on
Commit
1214e93
1 Parent(s): d490ea7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -6,6 +6,9 @@ Usage:
6
  python demo.py <config-path>
7
  """
8
 
 
 
 
9
  import argparse
10
  import importlib
11
  import os
@@ -21,6 +24,9 @@ import torch
21
  import gradio as gr
22
 
23
 
 
 
 
24
  MODEL_TYPES = ["v1.1"]
25
  CONFIG_MAP = {
26
  "v1.1-stage2": "configs/opensora-v1-1/inference/sample-ref.py",
@@ -40,9 +46,13 @@ RESOLUTION_MAP = {
40
  }
41
 
42
 
 
 
 
43
  # ============================
44
  # Utils
45
  # ============================
 
46
  def collect_references_batch(reference_paths, vae, image_size):
47
  from opensora.datasets.utils import read_from_path
48
 
@@ -150,9 +160,13 @@ def extract_json_from_prompts(prompts):
150
  return ret_prompts, additional_infos
151
 
152
 
 
 
 
153
  # ============================
154
  # Runtime Environment
155
  # ============================
 
156
  def install_dependencies(enable_optimization=False):
157
  """
158
  Install the required dependencies for the demo if they are not already installed.
@@ -207,6 +221,9 @@ def read_config(config_path):
207
  return Config.fromfile(config_path)
208
 
209
 
 
 
 
210
  def build_models(model_type, config, enable_optimization=False):
211
  """
212
  Build the models for the given model type and configuration.
@@ -269,6 +286,9 @@ def parse_args():
269
  return parser.parse_args()
270
 
271
 
 
 
 
272
  # ============================
273
  # Main Gradio Script
274
  # ============================
 
6
  python demo.py <config-path>
7
  """
8
 
9
+
10
+
11
+ # インポート
12
  import argparse
13
  import importlib
14
  import os
 
24
  import gradio as gr
25
 
26
 
27
+
28
+ # 定数の定義
29
+
30
  MODEL_TYPES = ["v1.1"]
31
  CONFIG_MAP = {
32
  "v1.1-stage2": "configs/opensora-v1-1/inference/sample-ref.py",
 
46
  }
47
 
48
 
49
+
50
+ # ユーティリティ関数
51
+
52
  # ============================
53
  # Utils
54
  # ============================
55
+
56
  def collect_references_batch(reference_paths, vae, image_size):
57
  from opensora.datasets.utils import read_from_path
58
 
 
160
  return ret_prompts, additional_infos
161
 
162
 
163
+
164
+ # 実行環境の設定
165
+
166
  # ============================
167
  # Runtime Environment
168
  # ============================
169
+
170
  def install_dependencies(enable_optimization=False):
171
  """
172
  Install the required dependencies for the demo if they are not already installed.
 
221
  return Config.fromfile(config_path)
222
 
223
 
224
+
225
+ # モデルの構築
226
+
227
  def build_models(model_type, config, enable_optimization=False):
228
  """
229
  Build the models for the given model type and configuration.
 
286
  return parser.parse_args()
287
 
288
 
289
+
290
+ # メイン関数
291
+
292
  # ============================
293
  # Main Gradio Script
294
  # ============================