revise space

This commit is contained in:
layerdiffusion
2024-08-18 19:25:39 -07:00
parent 22a19943d2
commit 60dfcd0464

View File

@@ -129,7 +129,11 @@ class ForgeSpace:
return self.refresh_gradio()
def gradio_worker(self):
import spaces
spaces.unload_module()
memory_management.unload_all_models()
sys.path.insert(0, self.root_path)
sys.path.insert(0, self.hf_path)
file_path = os.path.join(self.root_path, 'forge_app.py')
module_name = 'forge_space_' + str(uuid.uuid4()).replace('-', '_')
@@ -161,6 +165,7 @@ class ForgeSpace:
del sys.modules[module_name]
sys.path.remove(self.hf_path)
sys.path.remove(self.root_path)
return