Skip to content

Commit

Permalink
Merge pull request #3 from DalgoT4D/2-scaffold-the-application
Browse files Browse the repository at this point in the history
2-scaffold-the-application
  • Loading branch information
fatchat committed Feb 3, 2024
2 parents 68cea6c + 1310411 commit 895ff0b
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# dalgo-ai
Standalone service for AI
# FastAPI Machine Learning API

## Overview

This service exposes an API for various machine-learning tasks, designed to be called by the Dalgo backend.

## Installation and Setup

### Prerequisites

- Python 3.6 or higher
- Pip (Python package installer)

### Clone the Repository

```bash
git clone <repository_url>
cd <repository_name>
```
### Create and Activate Virtual Environment
```bash
python -m venv venv
```

#### On Windows:
```bash
.\venv\Scripts\activate
```
#### On Linux/Mac:
```bash
source venv/bin/activate
```
### Install Dependencies
```bash
pip install -r requirements.txt
```
### Run the Application
```bash
python main.py --port 8080
```
> The FastAPI application will be accessible at http://127.0.0.1:8080.
21 changes: 21 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# main.py
from fastapi import FastAPI
import uvicorn
import argparse

def create_app():
app = FastAPI()

@app.get("/healthcheck")
def healthcheck():
return {"status": "ok"}

return app

if __name__ == "__main__":

parser = argparse.ArgumentParser(description="FastAPI Machine Learning API")
parser.add_argument("--port", type=int, default=8000, help="Port number to bind the FastAPI application")
args = parser.parse_args()

uvicorn.run("main:create_app", host="127.0.0.1", port=args.port, reload=True)
14 changes: 14 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
annotated-types==0.6.0
anyio==4.2.0
click==8.1.7
colorama==0.4.6
exceptiongroup==1.2.0
fastapi==0.109.0
h11==0.14.0
idna==3.6
pydantic==2.6.0
pydantic_core==2.16.1
sniffio==1.3.0
starlette==0.35.1
typing_extensions==4.9.0
uvicorn==0.27.0.post1

0 comments on commit 895ff0b

Please sign in to comment.