Sean-Case commited on
Commit
febdc08
1 Parent(s): 114048b

Removed bootstrapper.py as it may confuse HF

Browse files
Files changed (3) hide show
  1. .gitignore +4 -2
  2. app.py +0 -1
  3. bootstrapper.py +0 -63
.gitignore CHANGED
@@ -1,5 +1,7 @@
1
  *.pyc
2
  *.ipynb
3
  *.pdf
4
- */build
5
- */dist
 
 
 
1
  *.pyc
2
  *.ipynb
3
  *.pdf
4
+ *.spec
5
+ *.toc
6
+ build/*
7
+ dist/*
app.py CHANGED
@@ -2,7 +2,6 @@
2
 
3
  # +
4
  import os
5
- import copy
6
 
7
  # Need to overwrite version of gradio present in Huggingface spaces as it doesn't have like buttons/avatars (Oct 2023)
8
  #os.system("pip uninstall -y gradio")
 
2
 
3
  # +
4
  import os
 
5
 
6
  # Need to overwrite version of gradio present in Huggingface spaces as it doesn't have like buttons/avatars (Oct 2023)
7
  #os.system("pip uninstall -y gradio")
bootstrapper.py DELETED
@@ -1,63 +0,0 @@
1
- import sys
2
- import os
3
- import subprocess
4
- import logging
5
-
6
- # Set up logging
7
- logging.basicConfig(filename='bootstrapper.log', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
8
-
9
- ENV_DIR = "app_env"
10
-
11
- def create_virtual_env():
12
- logging.info("Checking for virtual environment at {}".format(ENV_DIR))
13
-
14
- if not os.path.exists(ENV_DIR):
15
- logging.info("Virtual environment not found. Creating a new one.")
16
-
17
- # Import virtualenv and create a new environment
18
- import virtualenv
19
- virtualenv.create_environment(ENV_DIR)
20
-
21
- def install_dependencies():
22
- logging.info("Installing dependencies.")
23
-
24
- # Ensure the requirements.txt file is bundled with your application
25
- requirements_path = "requirements.txt"
26
-
27
- # pip executable within the virtual environment
28
- pip_path = os.path.join(ENV_DIR, 'Scripts', 'pip')
29
-
30
- try:
31
- subprocess.check_call([pip_path, "install", "-r", requirements_path])
32
- logging.info("Dependencies installed successfully.")
33
- except Exception as e:
34
- logging.error("Error installing dependencies: {}".format(e))
35
-
36
- def main():
37
- #try:
38
- # create_virtual_env()
39
- #except Exception as e:
40
- # logging.error("An error occurred in the bootstrapper: {}".format(e), exc_info=True)
41
-
42
- try:
43
- import langchain
44
- except ImportError:
45
- logging.warning("Some dependencies are missing. Attempting to install.")
46
- install_dependencies()
47
-
48
- # Now you can run your main application logic.
49
- # If it's in another file, you can use exec as shown before.
50
- try:
51
- with open('app.py', 'r') as file:
52
- exec(file.read())
53
- logging.info("Main application executed successfully.")
54
- except Exception as e:
55
- logging.error("Error executing main application: {}".format(e))
56
-
57
- if __name__ == "__main__":
58
- logging.info("Bootstrapper started.")
59
- try:
60
- main()
61
- logging.info("Bootstrapper finished.")
62
- except Exception as e:
63
- logging.error("An error occurred in the bootstrapper: {}".format(e))