Tolulope Ogunremi commited on
Commit
179134f
·
1 Parent(s): 6700abb

remove private repo from req

Browse files
Files changed (2) hide show
  1. app.py +45 -13
  2. requirements.txt +0 -1
app.py CHANGED
@@ -1,22 +1,54 @@
1
  import gradio as gr
2
  import os
3
  import sys
 
 
4
 
5
- # Install private package at startup
6
- print("Installing private package...")
7
- gh_token = os.environ.get("GH_TOKEN")
8
- if not gh_token:
9
- raise ValueError("GH_TOKEN not found in environment variables")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- package_url = f"git+https://{gh_token}@github.com/tolulope/speech-model-analysis.git"
12
- os.system(f"{sys.executable} -m pip install {package_url}")
13
 
14
- # Now import from your private package
15
- from speech_model_analysis import (
16
- VoxCommunisPreprocessor,
17
- MultiModelAnalyzer,
18
- create_hubert_configs
19
- )
20
 
21
  print("Private package loaded successfully!")
22
 
 
1
  import gradio as gr
2
  import os
3
  import sys
4
+ import subprocess
5
+ import importlib
6
 
7
+ def install_private_package():
8
+ """Install private package from GitHub using token"""
9
+ print("Installing private package...")
10
+
11
+ gh_token = os.environ.get("GH_TOKEN")
12
+ if not gh_token:
13
+ raise ValueError("GH_TOKEN not found in environment variables")
14
+
15
+ package_url = f"git+https://{gh_token}@github.com/tolulope/speech-model-analysis.git"
16
+
17
+ # Use subprocess for better error handling
18
+ result = subprocess.run(
19
+ [sys.executable, "-m", "pip", "install", "--no-cache-dir", package_url],
20
+ capture_output=True,
21
+ text=True
22
+ )
23
+
24
+ if result.returncode != 0:
25
+ print("STDOUT:", result.stdout)
26
+ print("STDERR:", result.stderr)
27
+ raise RuntimeError(f"Failed to install package: {result.stderr}")
28
+
29
+ print("✓ Package installed successfully!")
30
+
31
+ # Clear import caches so Python recognizes the new package
32
+ importlib.invalidate_caches()
33
+
34
+ # Install the package first
35
+ install_private_package()
36
+
37
+ # # Install private package at startup
38
+ # print("Installing private package...")
39
+ # gh_token = os.environ.get("GH_TOKEN")
40
+ # if not gh_token:
41
+ # raise ValueError("GH_TOKEN not found in environment variables")
42
 
43
+ # package_url = f"git+https://{gh_token}@github.com/tolulope/speech-model-analysis.git"
44
+ # os.system(f"{sys.executable} -m pip install {package_url}")
45
 
46
+ # # Now import from your private package
47
+ # from speech_model_analysis import (
48
+ # VoxCommunisPreprocessor,
49
+ # MultiModelAnalyzer,
50
+ # create_hubert_configs
51
+ # )
52
 
53
  print("Private package loaded successfully!")
54
 
requirements.txt CHANGED
@@ -1,2 +1 @@
1
  gradio
2
- git+https://${GH_TOKEN}@github.com/tolulope/speech-model-analysis.git
 
1
  gradio