forked from simran142002/dalgo-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from DalgoT4D/2-scaffold-the-application
2-scaffold-the-application
- Loading branch information
Showing
3 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |