Christen Millerdurai commited on
Commit
761864b
·
1 Parent(s): 35cb562
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -235,11 +235,17 @@ def ensure_egoforce_assets(repo_root: Path) -> None:
235
 
236
  def launch_upstream_gradio(repo_root: Path) -> None:
237
  demo_entrypoint = repo_root / "demo" / "run_app.py"
 
238
  server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
239
  server_port = os.environ.get("PORT") or os.environ.get("GRADIO_SERVER_PORT") or "7860"
240
 
241
  os.chdir(repo_root)
242
- sys.path.insert(0, str(repo_root))
 
 
 
 
 
243
  sys.argv = [
244
  str(demo_entrypoint),
245
  "--server-name",
 
235
 
236
  def launch_upstream_gradio(repo_root: Path) -> None:
237
  demo_entrypoint = repo_root / "demo" / "run_app.py"
238
+ demo_dir = demo_entrypoint.parent
239
  server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
240
  server_port = os.environ.get("PORT") or os.environ.get("GRADIO_SERVER_PORT") or "7860"
241
 
242
  os.chdir(repo_root)
243
+ for import_path in (repo_root, demo_dir):
244
+ import_path_string = str(import_path)
245
+ if import_path_string in sys.path:
246
+ sys.path.remove(import_path_string)
247
+ sys.path.insert(0, import_path_string)
248
+
249
  sys.argv = [
250
  str(demo_entrypoint),
251
  "--server-name",