MuhammadHafizFassya commited on
Commit
e3caf90
·
verified ·
1 Parent(s): 33d01a6

Upload 6 files

Browse files
Files changed (6) hide show
  1. .env +6 -0
  2. .env.example +6 -0
  3. .gitignore +8 -0
  4. Dockerfile +27 -0
  5. README.md +26 -10
  6. requirements.txt +12 -0
.env ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ PORT=8000
2
+ HOST=0.0.0.0
3
+ MODEL_PATH=../chronos-t5-tiny
4
+ MODEL_SOURCE=local
5
+ # Tambahkan URL Vercel Anda di bawah ini
6
+ CORS_ORIGINS=["http://localhost:3000", "https://chronos-forecast-dashboard.vercel.app"]
.env.example ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ PORT=8000
2
+ HOST=0.0.0.0
3
+ MODEL_ID=amazon/chronos-t5-tiny
4
+ MODEL_PATH=./chronos-t5-tiny
5
+ MODEL_SOURCE=local
6
+ CORS_ORIGINS=["http://localhost:3000"]
.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ .venv/
3
+ .env
4
+ *.pyc
5
+ .ipynb_checkpoints/
6
+ data/
7
+ outputs/
8
+ model_cache/
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.10 as base image
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ curl \
11
+ software-properties-common \
12
+ git \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Copy requirements and install dependencies
16
+ COPY requirements.txt .
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the rest of the application code
20
+ COPY . .
21
+
22
+ # Expose the port (Hugging Face Spaces uses 7860 by default)
23
+ EXPOSE 7860
24
+
25
+ # Command to run the application
26
+ # We use 0.0.0.0 to bind to all interfaces
27
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,10 +1,26 @@
1
- ---
2
- title: Chronos Predict Api
3
- emoji: 🐢
4
- colorFrom: yellow
5
- colorTo: yellow
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Backend - Amazon Chronos Forecasting
2
+
3
+ ## Setup & Run
4
+
5
+ 1. **Virtual Environment**
6
+ ```bash
7
+ py -m venv .venv
8
+ .venv\Scripts\activate
9
+ ```
10
+
11
+ 2. **Install Dependencies**
12
+ ```bash
13
+ py -m pip install -r requirements.txt
14
+ ```
15
+
16
+ 3. **Environment Setup**
17
+ Copy `.env.example` to `.env` and adjust if needed.
18
+
19
+ 4. **Run Server**
20
+ ```bash
21
+ uvicorn app.main:app --reload
22
+ ```
23
+
24
+ ## Endpoints
25
+ - `GET /health`: Health check.
26
+ - `POST /api/forecast`: Main forecasting endpoint.
requirements.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fastapi
2
+ uvicorn
3
+ pydantic
4
+ pydantic-settings
5
+ pandas
6
+ torch
7
+ transformers
8
+ accelerate
9
+ chronos-forecasting
10
+ python-dotenv
11
+ python-multipart
12
+ cors