Ensure your API server includes the following two routes:
- Method:
GET
- Response: Return a JSON object with the following structure:
{ "status": "ok" }
- Method:
POST
- Input: Receives a
MinerInput
object. This object represents the challenge sent by the validator. - Output: Returns a
MinerOutput
object. This object contains your response to the challenge.
Both MinerInput
and MinerOutput
are defined in:
readteam_core/challenge_pool/<challenge_name>/data_types.py
To package your submission using Docker, follow these steps:
Make sure to include a requirements.txt
file in the root directory with all necessary dependencies for your project. For example:
fastapi
uvicorn
transformers
accelerate
You can generate a requirements.txt
file using pip freeze > requirements.txt
if you have a virtual environment set up.
Create a Dockerfile
in the root directory of your project to define the container image. Below is an example template for the Dockerfile
:
# Use a base image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file into the container
COPY requirements.txt .
# Install the dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy all necessary files into the container
COPY . .
# Expose the port the app runs on (must be 10002)
EXPOSE 10002
# Run the app using the command (adjust accordingly if using Flask or FastAPI)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "10002"]
After creating the Dockerfile
and requirements.txt
, you can build, tag your Docker image and push it to Docker Hub. Refer to the documentation for Docker.
You can view the tutorial for text detection submission here.