File size: 1,953 Bytes
a9c2120
 
 
 
 
 
99d6fba
 
a9c2120
 
 
 
99d6fba
 
 
 
 
a9c2120
99d6fba
 
a9c2120
99d6fba
 
a9c2120
99d6fba
a9c2120
99d6fba
a9c2120
 
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
1. Create minimal environment to run the app in conda. E.g. 'conda create --name new_env'

2. Activate the environment 'conda activate new_env'

3. cd to this folder. Install packages from requirements.txt using 'pip install -r requirements.txt' 

NOTE: for ensuring that spaCy models are loaded into the program correctly in requirements.txt, follow this guide: https://spacy.io/usage/models#models-download

4. In file explorer, navigate to the miniconda/envs/new_env/Lib/site-packages/gradio-client/ folder

5. Copy types.json from the gradio_client folder to the folder containing the data_text_search.py file

6. If necessary, create hook- files to tell pyinstaller to include specific packages in the exe build. Examples are provided for gradio and en_core_web_sm (a spaCy model).

7. pip install pyinstaller

8. In command line, cd to the folder that contains app.py. Then run the following:

For one single file:
python -m PyInstaller --additional-hooks-dir=. --hidden-import pyarrow.vendored.version --add-data="types.json;gradio_client" --add-data "model;model" --onefile --clean --noconfirm --upx-dir="C:\Program Files\UPX\upx-4.2.2-win64" --name DataSearchApp_0.1 app.py

For a small exe with a folder of dependencies:
python -m PyInstaller --additional-hooks-dir=. --hidden-import pyarrow.vendored.version --add-data="types.json;gradio_client" --add-data "model;model" --clean --noconfirm --upx-dir="C:\Program Files\UPX\upx-4.2.2-win64" --name DataSearchApp_0.1 app.py

9. A 'dist' folder will be created with the executable inside along with all dependencies('dist\data_text_search'). 

10. In 'dist\data_text_search' try double clicking on the .exe file. After a short delay, the command prompt should inform you about the IP address of the app that is now running. Copy the IP address. **Do not close this window!**

11. In an Internet browser, navigate to the indicated IP address. The app should now be running in your browser window.