wdcqc commited on
Commit
a6d6814
1 Parent(s): 22341b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -12
app.py CHANGED
@@ -5,19 +5,27 @@ import argparse
5
  import os
6
  import urllib.request
7
 
8
- if __name__ == "__main__":
9
- try:
10
- os.makedirs("/home/user/.local/lib/python3.8/site-packages/wfd/mpqapi/")
11
- except Exception as e:
12
- print(e)
13
- # try to fix the CDLL problem
14
- urllib.request.urlretrieve("https://github.com/wdcqc/WaveFunctionDiffusion/raw/remaster/wfd/mpqapi/libstorm.so", "/home/user/.local/lib/python3.8/site-packages/wfd/mpqapi/libstorm.so")
15
- urllib.request.urlretrieve("https://github.com/wdcqc/WaveFunctionDiffusion/raw/remaster/wfd/mpqapi/libstorm.so", "libstorm.so")
 
 
 
 
 
 
 
16
 
17
- if os.path.exists("/home/user/.local/lib/python3.8/site-packages/wfd/mpqapi/libstorm.so"):
18
- print("libstorm EXISTS!!!")
19
- else:
20
- print("libstorm DOES NOT EXIST!!!")
 
21
 
22
  from wfd.webui import start_demo
23
  class Arguments:
 
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):
12
+ try:
13
+ os.makedirs("/home/user/.local/lib/python3.8/site-packages/wfd/{}".format(os.path.dirname(path)))
14
+ except Exception as e:
15
+ print(e)
16
+ try:
17
+ urllib.request.urlretrieve(
18
+ "https://github.com/wdcqc/WaveFunctionDiffusion/raw/remaster/wfd/{}".format(path),
19
+ target_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
 
30
  from wfd.webui import start_demo
31
  class Arguments: