annabossler commited on
Commit
eec5771
·
verified ·
1 Parent(s): 6cb744f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -2,21 +2,21 @@ import subprocess
2
  import sys
3
  from pathlib import Path
4
 
5
- # Forgot README.md creating it
6
- readme_path = Path(__file__).parent / "gradio_molecule3d" / "README.md"
7
- if not readme_path.exists():
8
- readme_path.write_text("# Gradio Molecule3D\n\nCustom component for molecular visualization.\n")
9
 
10
-
11
- # Build and install gradio_molecule3d
12
  print("Building gradio_molecule3d...")
13
  subprocess.run(["gradio", "cc", "build"], cwd=Path(__file__).parent / "gradio_molecule3d/", check=True)
14
- print("Installing gradio_molecule3d...")
15
- whl_file = list((Path(__file__).parent / "gradio_molecule3d" / "dist").glob("*.whl"))[0]
16
- subprocess.run([sys.executable, "-m", "pip", "install", str(whl_file)], check=True)
17
- print("gradio_molecule3d installed successfully")
18
 
19
- # Fixing order of imports
 
 
 
 
 
20
  import os
21
  os.environ["TORCH_DYNAMO_DISABLE"] = "1"
22
  import tempfile
 
2
  import sys
3
  from pathlib import Path
4
 
5
+ # Instalar dependencias npm primero
6
+ print("Installing npm dependencies...")
7
+ frontend_path = Path(__file__).parent / "gradio_molecule3d" / "frontend"
8
+ subprocess.run(["npm", "install"], cwd=frontend_path, check=True)
9
 
10
+ # Ahora compilar
 
11
  print("Building gradio_molecule3d...")
12
  subprocess.run(["gradio", "cc", "build"], cwd=Path(__file__).parent / "gradio_molecule3d/", check=True)
 
 
 
 
13
 
14
+ print("Installing wheel...")
15
+ whl_files = list((Path(__file__).parent / "gradio_molecule3d" / "dist").glob("*.whl"))
16
+ if whl_files:
17
+ subprocess.run([sys.executable, "-m", "pip", "install", str(whl_files[0])], check=True)
18
+
19
+ # Ahora sí, imports
20
  import os
21
  os.environ["TORCH_DYNAMO_DISABLE"] = "1"
22
  import tempfile