From 113fb18ce81424f9da02bf58edaeb6d081e249f5 Mon Sep 17 00:00:00 2001 From: neelasha23 Date: Fri, 2 Feb 2024 21:49:27 +0530 Subject: [PATCH] reamde changes --- doc/apps/shiny.md | 16 ++++++++-------- examples/docker/shiny/README.md | 6 ++++-- examples/docker/shiny/app.py | 2 -- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/apps/shiny.md b/doc/apps/shiny.md index bf923a66..0f12eeb4 100644 --- a/doc/apps/shiny.md +++ b/doc/apps/shiny.md @@ -1,22 +1,22 @@ -# Shiny Core +# Shiny -To deploy a [Shiny Core](https://shiny.posit.co/py/docs/overview.html) application to Ploomber Cloud you need: +To deploy a [Shiny](https://shiny.posit.co/py/docs/overview.html) application to Ploomber Cloud you need: - A `Dockerfile` - A Shiny project ## `Dockerfile` -Use this [template](https://github.com/ploomber/doc/blob/main/examples/docker/shiny-core/Dockerfile) `Dockerfile`: +Use this [template](https://github.com/ploomber/doc/blob/main/examples/docker/shiny/Dockerfile) `Dockerfile`: ```Dockerfile FROM python:3.11 -COPY app-core.py app-core.py +COPY app.py app.py COPY requirements.txt requirements.txt RUN pip install -r requirements.txt -ENTRYPOINT ["shiny", "run", "app-core.py", "--host", "0.0.0.0", "--port", "80"] +ENTRYPOINT ["shiny", "run", "app.py", "--host", "0.0.0.0", "--port", "80"] ``` ## Testing locally @@ -25,10 +25,10 @@ To test your app, you can use `docker` locally: ```sh # build the docker image -docker build . -t shiny-core-app +docker build . -t shiny-app # run it -docker run -p 5000:80 shiny-core-app +docker run -p 5000:80 shiny-app ``` Now, open [http://0.0.0.0:5000/](http://0.0.0.0:5000/) to see your app. @@ -38,6 +38,6 @@ Now, open [http://0.0.0.0:5000/](http://0.0.0.0:5000/) to see your app. Once you have all your files, create a zip file. -To deploy a Shiny Core app from the deployment menu, select the Docker option and follow the instructions: +To deploy a Shiny app from the deployment menu, select the Docker option and follow the instructions: ![](../static/docker.png) \ No newline at end of file diff --git a/examples/docker/shiny/README.md b/examples/docker/shiny/README.md index 0b37f567..be20022e 100644 --- a/examples/docker/shiny/README.md +++ b/examples/docker/shiny/README.md @@ -7,7 +7,8 @@ This app is built on Shiny and allows you to visualize model training accuracy s ## Connecting to MongoDB Cloud -For the purpose of this tutorial we will use the `MongoDB Atlas` cloud database. Let's see the steps for creating a cluster: +For the purpose of this tutorial we will use the `MongoDB Atlas` cloud database. It allows users to host a database for free. +Let's see the steps for creating a cluster: First create an account on [MongoDB cloud](https://www.mongodb.com/atlas/database) and create a new project: @@ -32,6 +33,7 @@ Once you have completed the access rules setup, select the `CONNECT` button on t ## Deploy application Create a zip file using `Dockerfile`, `app-core.py` and `requirements.txt` and deploy this file to Ploomber cloud. +Refer to the [Shiny deployment documentation](https://docs.cloud.ploomber.io/en/latest/apps/shiny.html) for more details. Once the `VIEW APPLICATION` button is enabled, you can start the training script and monitor the training. ## Train models @@ -45,7 +47,7 @@ First create a virtual environment and install the required packages: pip install tensorflow scikit-learn "pymongo[srv]" ``` -Then run the training scripts parallely.: +Then run the training scripts parallely: ```bash python train_one.py & python train_two.py & wait diff --git a/examples/docker/shiny/app.py b/examples/docker/shiny/app.py index ea9bd22b..cdd8d56f 100644 --- a/examples/docker/shiny/app.py +++ b/examples/docker/shiny/app.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import pandas as pd import plotly.express as px from shinywidgets import output_widget, render_widget