This web application has been designed to hep users fetch answers to questions using numnerous NLP models . Users willl be able to view the list of available models , add new models , delete existing models , ask a question and upload a CSV with bulk questions. This application is made using streamlit library and it calls a flask api to make requests and fetch responses. Backend is esentially Postgresql in cloud database. Refer below architecture for more details
https://webapp-sueoei3pla-uc.a.run.app (Since the web app was delpoyed using Google cloud and the account is currently de-activated hence it is not working as of now, but users can read below description and screenshots to rebuild it)
To use this app : Click on the above URL
Returns the list of existing models in the system
Let's you add a new model and will return a list of existing models
Let's you delete an existing model and will return the list of remaining models
Use this to post your questions along with context . You may select a model as well
Use this to bulk upload your questions using a CSV
To run this web application, you'll need the following pre-requisites installed on your machine
Library | Version | Installation |
---|---|---|
Python | 3.9.1 or above | Python |
Streamlit | 0.82.0 | pip install streamlit |
Docker Engine | NA | Docker |
Pandas | NA | pip install pandas |
You need to install all the dependencies available in requirements.txt
There are two ways to deploy the Web App on your local machine:
1. Deployment with Streamlit:
1. To deploy the app on your local machine through Streamlit, we just need to run the python file using command streamlit run App.py(which is the name of python file having code for the application)
>>> streamlit run webapp.py
2. This will deploy your webapp on your local machine. Post successful deployment of the code
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://10.0.0.244:8501
3. You can access the web app through chrome, edge or any web browser and start sending requests to the REST API through the portal.
2. Deployment through Docker:
- To deploy the app on your local machine through docker, we need a docker file ,given we already have the application file created, that would be the recipe for docker to build the application
- In the dockerfile, we will add the required dependency of python:3.7-slim
- Once the dockerfile is created, we'll execute the deployment of the docker container which would be published and deployed
- We'll copy the webapp.py in the app folder and the application would run once the docker image was deployed
Sample Dockerfile
FROM python:3.7-slim
EXPOSE 8080
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
RUN pip install requests streamlit
CMD ["streamlit", "run", "--server.port", "8080", "--server.enableCORS", "false", "webapp.py"]
Building the Docker Image in the Active Directory/Folder
sudo docker build -t <image-name> .
Running the Docker Image - with ports defined for communication between local machine and docker image
sudo docker run -it -p 8501:8501 <image-name> /app/<aap-name>.py