-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapCombine.py
More file actions
32 lines (26 loc) · 1.04 KB
/
capCombine.py
File metadata and controls
32 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import sys
import subprocess
def create_venv():
print("Creating virtual environment 'venv'...")
if sys.platform == "darwin": # MacOS
subprocess.run(["python3", "-m", "venv", "venv"])
else: # Windows and others
subprocess.run(["python", "-m", "venv", "venv"])
print("Virtual environment created successfully!")
def install_dependencies():
print("Installing required dependencies...")
pip_command = "pip3" if sys.platform == "darwin" else "pip"
# Return the command to install Gradio
return f"{pip_command} install gradio==3.44.4"
def main():
# Check if venv exists
if not os.path.exists("venv"):
create_venv()
else:
print("Virtual environment 'venv' already exists.")
# Activate venv and install dependencies
activate_venv = ".\\venv\\Scripts\\activate" if os.name == "nt" else "source venv/bin/activate"
os.system(f"{activate_venv} && {install_dependencies()} && python launch.py")
if __name__ == "__main__":
main()