Browse Source

Update __init__.py

pull/7/head
tin2tin 2 years ago committed by GitHub
parent
commit
dfdab54342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      __init__.py

31
__init__.py

@ -17,7 +17,7 @@ import subprocess
import sys import sys
def import_module(self, module): def import_module(self, module, install_module):
module = str(module) module = str(module)
try: try:
exec("import " + module) exec("import " + module)
@ -34,7 +34,7 @@ def import_module(self, module):
pass pass
self.report({"INFO"}, "Installing: " + module + " module.") self.report({"INFO"}, "Installing: " + module + " module.")
print("Installing: " + module + " module") print("Installing: " + module + " module")
subprocess.check_call([pybin, "-m", "pip", "install", module]) subprocess.check_call([pybin, "-m", "pip", "install", install_module])
try: try:
exec("import " + module) exec("import " + module)
except ModuleNotFoundError: except ModuleNotFoundError:
@ -62,28 +62,11 @@ class SequencerImportMovieOperator(Operator):
sys.path.append(app_path) sys.path.append(app_path)
pybin = sys.executable pybin = sys.executable
import_module(self, "open_clip_torch") import_module(self, "open_clip_torch", "open_clip_torch")
import_module(self, "pytorch_lightning") import_module(self, "pytorch_lightning", "pytorch_lightning")
import_module(self, "gast") import_module(self, "gast", "gast")
import_module(self, "tensorflow") import_module(self, "tensorflow", "tensorflow")
import_module(self, "modelscope", "modelscope==1.4.2") #git+https://github.com/modelscope/modelscope.git
try:
import modelscope
except ModuleNotFoundError:
try:
subprocess.call([pybin, "-m", "ensurepip"])
except ImportError:
pass
subprocess.check_call(
[
pybin,
"-m",
"pip",
"install",
"git+https://github.com/modelscope/modelscope.git",
"--user",
]
)
from modelscope.pipelines import pipeline from modelscope.pipelines import pipeline
from modelscope.outputs import OutputKeys from modelscope.outputs import OutputKeys

Loading…
Cancel
Save