yuna0x0 commited on
Commit
0db1bcd
·
unverified ·
1 Parent(s): 9aae906

fix: mmcv-full should reinstall using mim

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -2,6 +2,19 @@ import argparse
2
  import functools
3
  import pathlib
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  import cv2
6
  import gradio as gr
7
  import numpy as np
@@ -111,9 +124,7 @@ def main():
111
  ],
112
  ],
113
  live=args.live,
114
- ).launch(
115
- debug=args.debug, share=args.share, server_port=args.port
116
- )
117
 
118
 
119
  if __name__ == "__main__":
 
2
  import functools
3
  import pathlib
4
 
5
+ import os
6
+ import subprocess
7
+
8
+ if os.environ.get("SYSTEM") == "spaces":
9
+ import mim
10
+
11
+ mim.uninstall("mmcv-full", confirm_yes=True)
12
+ mim.install("mmcv-full==1.6.2", is_yes=True)
13
+
14
+ subprocess.call("pip uninstall -y opencv-python".split())
15
+ subprocess.call("pip uninstall -y opencv-python-headless".split())
16
+ subprocess.call("pip install opencv-python-headless==4.7.0.72".split())
17
+
18
  import cv2
19
  import gradio as gr
20
  import numpy as np
 
124
  ],
125
  ],
126
  live=args.live,
127
+ ).launch(debug=args.debug, share=args.share, server_port=args.port)
 
 
128
 
129
 
130
  if __name__ == "__main__":