wdcqc commited on
Commit
747bede
1 Parent(s): 4cb29fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -18
app.py CHANGED
@@ -5,11 +5,10 @@ import argparse
5
  import os
6
  import urllib.request
7
  import json
8
- import tqdm
9
 
10
- # the tqdm package is chosen with a dice, completely random.
11
- SITE_PACKAGES_DIR = os.path.dirname(os.path.dirname(tqdm.__file__))
12
- WFD_DIR = os.path.join(SITE_PACKAGES_DIR, "wfd")
13
 
14
  def fix_theme(theme):
15
  try:
@@ -57,24 +56,26 @@ def fix_package_file(path):
57
  print("{} is fixed!".format(path))
58
 
59
  if __name__ == "__main__":
60
- print("SITE_PACKAGES_DIR =", SITE_PACKAGES_DIR)
61
- print("WFD_DIR =", WFD_DIR, "and it", "exists" if os.path.exists(WFD_DIR) else "does not exist")
62
- fix_package_file("mpqapi/libstorm.so")
63
- fix_package_file("webui/templates/tempura.css")
64
- fix_package_file("webui/templates/background.css")
65
- fix_package_file("webui/doki_settings.json")
66
- fix_local_file("tile_data/platform.cv5.bin")
67
- fix_local_file("tile_data/platform.png")
68
- fix_local_file("tile_data/platform_mapping.npz")
69
- fix_local_file("tile_data/platform_v2.npz")
70
- fix_local_file("tile_data/wfc/platform_32x32.npz")
71
- fix_local_file("default/base.chk")
72
 
73
- fix_theme("KonoSuba: Darkness Light")
74
 
75
- from wfd.webui import start_demo
76
  class Arguments:
77
  colab = False
78
  link_to_colab = True
79
  args = Arguments()
 
 
 
80
  start_demo(args)
 
5
  import os
6
  import urllib.request
7
  import json
8
+ import importlib
9
 
10
+ # do it properly
11
+ WFD_DIR = os.path.dirname(importlib.util.find_spec("wfd").origin)
 
12
 
13
  def fix_theme(theme):
14
  try:
 
56
  print("{} is fixed!".format(path))
57
 
58
  if __name__ == "__main__":
59
+ print("WFD_DIR =", WFD_DIR)
60
+ # fix_package_file("mpqapi/libstorm.so")
61
+ # fix_package_file("webui/templates/tempura.css")
62
+ # fix_package_file("webui/templates/background.css")
63
+ # fix_package_file("webui/doki_settings.json")
64
+ # fix_local_file("tile_data/platform.cv5.bin")
65
+ # fix_local_file("tile_data/platform.png")
66
+ # fix_local_file("tile_data/platform_mapping.npz")
67
+ # fix_local_file("tile_data/platform_v2.npz")
68
+ # fix_local_file("tile_data/wfc/platform_32x32.npz")
69
+ # fix_local_file("default/base.chk")
 
70
 
71
+ # fix_theme("KonoSuba: Darkness Light")
72
 
73
+ from wfd.webui import set_theme, start_demo
74
  class Arguments:
75
  colab = False
76
  link_to_colab = True
77
  args = Arguments()
78
+
79
+ set_theme("KonoSuba: Darkness Light")
80
+
81
  start_demo(args)