wishwakankanamg commited on
Commit
fdcebbb
·
1 Parent(s): 831c5eb

new method

Browse files
Files changed (2) hide show
  1. __pycache__/graph.cpython-310.pyc +0 -0
  2. app.py +23 -7
__pycache__/graph.cpython-310.pyc CHANGED
Binary files a/__pycache__/graph.cpython-310.pyc and b/__pycache__/graph.cpython-310.pyc differ
 
app.py CHANGED
@@ -15,14 +15,24 @@ from pathlib import Path
15
 
16
  import subprocess
17
 
18
- def update_repo():
 
19
  try:
20
- subprocess.run(["git", "fetch", "origin"], check=True)
21
- subprocess.run(["git", "reset", "--hard", "origin/main"], check=True)
22
- except Exception as e:
23
- print(f"Git update failed: {e}")
 
 
 
 
 
24
 
25
- update_repo()
 
 
 
 
26
 
27
 
28
  load_dotenv()
@@ -844,4 +854,10 @@ if __name__ == "__main__":
844
  return current_prompt
845
 
846
 
847
- demo.launch(server_name="127.0.0.1", server_port=8080, share=True)
 
 
 
 
 
 
 
15
 
16
  import subprocess
17
 
18
+ def run_command(command_list, description):
19
+ print(f"Running: {description}")
20
  try:
21
+ subprocess.run(command_list, check=True)
22
+ except subprocess.CalledProcessError as e:
23
+ print(f"Error during: {description}\n{e}")
24
+ sys.exit(1)
25
+
26
+ def startup():
27
+ # Step 1: Update from origin
28
+ run_command(["git", "fetch", "origin"], "Git fetch")
29
+ run_command(["git", "reset", "--hard", "origin/main"], "Git reset")
30
 
31
+ # Step 2: Install Python dependencies
32
+ run_command([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], "Pip install requirements")
33
+
34
+ # Step 3: Run your app (replace with the correct entry point)
35
+ run_command([sys.executable, "app.py"], "Starting the app")
36
 
37
 
38
  load_dotenv()
 
854
  return current_prompt
855
 
856
 
857
+ demo.launch(server_name="127.0.0.1", server_port=8080, share=True)
858
+
859
+
860
+
861
+
862
+ if __name__ == "__main__":
863
+ startup()