wdcqc commited on
Commit
11c0069
1 Parent(s): 16e87a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -11
app.py CHANGED
@@ -5,7 +5,22 @@ import argparse
5
  import os
6
  import urllib.request
7
 
8
- def fix_file(path):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # I think this is because I did the setup.py wrong, but pip install git+repo works in colab so idk how to really fix
10
  target_path = "/home/user/.local/lib/python3.8/site-packages/wfd/{}".format(path)
11
  if not os.path.exists(target_path):
@@ -20,18 +35,20 @@ def fix_file(path):
20
  )
21
  except Exception as e:
22
  print(e)
 
 
23
 
24
  if __name__ == "__main__":
25
- fix_file("mpqapi/libstorm.so")
26
- fix_file("webui/templates/tempura.css")
27
- fix_file("webui/templates/background.css")
28
- fix_file("webui/doki_settings.json")
29
- fix_file("tile_data/wfc/platform_32x32.npz")
30
- fix_file("tile_data/platform.cv5.bin")
31
- fix_file("tile_data/platform.png")
32
- fix_file("tile_data/platform_mapping.npz")
33
- fix_file("tile_data/platform_v2.npz")
34
- fix_file("default/base.chk")
35
 
36
  from wfd.webui import start_demo
37
  class Arguments:
 
5
  import os
6
  import urllib.request
7
 
8
+ def fix_local_file(path):
9
+ # probably should include the tile files in the package
10
+ if not os.path.exists(target_path):
11
+ try:
12
+ os.makedirs(os.path.dirname(path))
13
+ except Exception as e:
14
+ print(e)
15
+ try:
16
+ urllib.request.urlretrieve(
17
+ "https://github.com/wdcqc/WaveFunctionDiffusion/raw/remaster/{}".format(path),
18
+ path
19
+ )
20
+ except Exception as e:
21
+ print(e)
22
+
23
+ def fix_package_file(path):
24
  # I think this is because I did the setup.py wrong, but pip install git+repo works in colab so idk how to really fix
25
  target_path = "/home/user/.local/lib/python3.8/site-packages/wfd/{}".format(path)
26
  if not os.path.exists(target_path):
 
35
  )
36
  except Exception as e:
37
  print(e)
38
+ else:
39
+ print("{} is fixed!".format(path))
40
 
41
  if __name__ == "__main__":
42
+ fix_package_file("mpqapi/libstorm.so")
43
+ fix_package_file("webui/templates/tempura.css")
44
+ fix_package_file("webui/templates/background.css")
45
+ fix_package_file("webui/doki_settings.json")
46
+ fix_local_file("tile_data/platform.cv5.bin")
47
+ fix_local_file("tile_data/platform.png")
48
+ fix_local_file("tile_data/platform_mapping.npz")
49
+ fix_local_file("tile_data/platform_v2.npz")
50
+ fix_local_file("tile_data/wfc/platform_32x32.npz")
51
+ fix_local_file("default/base.chk")
52
 
53
  from wfd.webui import start_demo
54
  class Arguments: