Sign inSign up

hoipangg/kopi

By hoipangg

•Updated almost 2 years ago

FastAPI-based Remote Python Execution Service

Image
Machine learning & AI
Developer tools
Data science
0

3.2K

hoipangg/kopi repository overview

⁠☕︎ Kopi


⁠🚀 FastAPI-based Remote Python Execution Service

FastAPI-based service that allows users to execute Python code remotely and return the results. The service provides an API endpoint for code execution and supports various output types, including text, images, and binary data.

⁠✨ Key Features
  • 🐍 Remote Python code execution
  • 🖼️ Support for image processing using PIL
  • 🔢 Base64 encoding for image and binary outputs
  • 📏 Size limit checks for inputs and outputs (20MB max)
  • 💓 Health check endpoint

⁠🏃‍♂️ Usage

To run the Kopi service, use the following Docker command to expose the service on localhost:5569

docker run -d -p 5569:5569 hoipangg/kopi

⁠🌐 API Endpoints

  • POST /execute
    Execute Python code remotely and return the result. Supports text, image, and binary outputs.

  • GET /health
    Check the health status of the service.


⁠🛠️ Base Image

  • Python 3.12 slim: Lightweight and efficient for high performance.

⁠📦 Preinstalled Libraries

Kopi comes preloaded with a rich set of Python libraries for diverse use cases:

  • 🚀 FastAPI & Uvicorn
  • 📊 Data Science: NumPy, Pandas, Matplotlib, Seaborn, SciPy, SymPy
  • 📈 Visualization: Plotly, Kaleido
  • 📜 Parsing & Requests: PyPDF2, Requests, BeautifulSoup4, lxml, PyYAML
  • 🖼️ Image Processing: Pillow, OpenCV (headless)

⁠🩺 Health and Security

  • 🛡️ Security Considerations: Ensure proper safeguards are in place when allowing remote code execution.
  • 📏 Input/Output Size Limit: Max size of 20MB to prevent resource abuse.
  • ⚙️ Service Port: Runs on port 5569 inside the container.

Tag summary

Content type

Image

Digest

sha256:876119530…

Size

433.8 MB

Last updated

almost 2 years ago

docker pull hoipangg/kopi