Spaces:
Runtime error
Runtime error
Upload 6 files
Browse files- .env +6 -0
- .env.example +6 -0
- .gitignore +8 -0
- Dockerfile +27 -0
- README.md +26 -10
- 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 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|