Javascript Integration with Docker and Machine Learning

Tinkal Shakya

--

Task 7.1

First, we should open the Rhel 8 terminal and stop the firewall security. Using these commands

setenforce 0

systemctl stop firewalld

systemctl disable firewalld

make sure first you have to install the httpd server using this command. if you already install then don’t run this command.

yum install httpd

and start the apache server, using this command.

systemctl start httpd

then, go to the directory cgi-bin and create the python file. and make an executable file.

cd /var/www/cgi-bin/

vi home.py

chmod +x home.py

and write the program.

In this program, we have to import the libraries' cgi and subprocess. The CGI library makes possible communication between clients and web servers. Whenever the client browser sends a request to the webserver, the CGI program sends the output back to the web server based on the input provided by the client-server. the content-type line is sent back to the browser and it specifies the content type to be displayed on the browser screen.

and after that, we will go to another directory “/var/www/html” and create an HTML file.

In this program, we will create a responsive web page. we have created a function to the request to the HTTP server and server send back to the response and show the output to the web page.

and after that go to the browser and type your IP and your HTML file name.

for example- 192.168.12.34/index.html

Now we will create a docker container to predict the salary.

First, we will create a new folder and go to this folder and put the dataset csv file, and then create a docker file.

vi Dockerfile

and write the code.

and create one python file “selaryPredict.py” and write the code.

In this program, we have import the warnings library to ignore the FutureWarning and show the clear output. we have read the dataset and split the train test model and fit the model using Linear Regression and predict the salary.

After that, Build the docker image and run it. Follow this commands

docker build . -t ml1:v1

docker run -it ml1

Complete Code in GitHub Repo — https://bit.ly/3daQDKm

and we can run also many commands like —

docker ps

docker run

docker images

docker rm -f

and more

After the Completion web page look like this —

--

--

No responses yet

Write a response