Skip to content

πŸš€ Building a Streamlit boilerplate with Streamlit, SQLite DB, and REST API.

License

Notifications You must be signed in to change notification settings

pranjalpruthi/Streamlit-FastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Building a Streamlit boilerplate with Streamlit, SQLite DB, and REST API.

Open in StackBlitz Open with CodeSandbox Open in GitHub Codespaces

πŸš€ Project Structure

Self-Hosted

Requirements

  • Python version > 3.10 🐍
  • Pip package manager πŸ“¦
  • Streamlit 🌟

Installation

    1. Clone the repository:
    git clone https://github.com/pranjalpruthi/Streamlit-FastAPI.git
  • Navigate to the project directory:

      cd Streamlit-FastAPI

    Create a new Python virtual environment, or use conda/mamba to create a new environment:

  • Python Virtual Environment:

      python -m venv apidemo
     source apidemo/bin/activate
  • Conda:

        conda create -n apidemo python=3.10
        conda activate apidemo
  • Mamba:

       mamba create -n apidemo
        mamba activate apidemo
  • Install the required dependencies:

  pip install -r requirements.txt

Running the Backend

Start the FastAPI backend server:

 uvicorn main:app --reload

The backend server will be running at http://localhost:8000/docs# πŸš€.

Access the Swagger UI documentation:

Open your browser and visit http://localhost:8000/docs πŸ“š. You will find the interactive API documentation powered by Swagger UI. Here, you can explore the available endpoints, test them, and view the response schemas.

(go to Swagger ui at localhost:8000/docs#/)

Fastapi Swagger UI Snip

CleanShot 2023-07-18 at 18 05 03@2x

Running the Streamlit Frontend

Open a new terminal session.

  • Navigate to the project directory (if not already there):

    cd Streamlit-FastAPI
  • Start the Streamlit app:

   streamlit run app.py

Access the Streamlit app:

Open your browser and visit http://localhost:8501 🌐. You will see the Streamlit app interface, where you can interact with the API and visualize the data.

(go to streamlit ui at localhost:8501)

Streamlit App Snip

CleanShot 2023-07-18 at 18 10 01@2x

Uninstall/Remove Enviorments

 deactivate  # deactivate the virtual environment
 rm -rf /path/to/apidemo  # delete the directory

 conda env remove --name apidemo

 mamba env remove --name apidemo

Contributing

We welcome contributions from the community! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request on GitHub.

License

This project is licensed under the AGPLv3 License ©️ Feel Free to use.

Sources and Citations

FastAPI: https://fastapi.tiangolo.com/ πŸš€ Streamlit: https://streamlit.io/ 🌟 SQLite: https://www.sqlite.org/ πŸ“š Feel free to explore the documentation and official websites of the tools used in this project for further information and guidance.

Happy coding! βœ¨πŸŽ‰πŸ‘©β€πŸ’»

About

πŸš€ Building a Streamlit boilerplate with Streamlit, SQLite DB, and REST API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages