- Added /model to git ignore.
- Modified server file a bit. - Added example Dockerfile
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -39,3 +39,6 @@ yarn-error.log*
|
|||||||
# typescript
|
# typescript
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
|
||||||
|
# Model files
|
||||||
|
python_server/models/
|
||||||
|
|||||||
18
python_server/Dockerfile
Normal file
18
python_server/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# 1. Start from a base image with Python installed
|
||||||
|
FROM python:3.13.7
|
||||||
|
|
||||||
|
# 2. Set the working directory in the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 3. Copy requirements file and install dependencies
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# 4. Copy the rest of your app’s code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# 5. Expose port (optional, for web apps)
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# 6. Default command to run the app
|
||||||
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
@@ -8,18 +8,23 @@ import base64
|
|||||||
import logging
|
import logging
|
||||||
from fastapi import FastAPI, Request
|
from fastapi import FastAPI, Request
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
#from pyngrok import ngrok, conf
|
#from pyngrok import ngrok, conf
|
||||||
|
|
||||||
#conf.get_default().auth_token = "31y03xgLo8cpZ0WujlWkTCT34qK_86cXFLfdH2c3gX3SEezaz"
|
#conf.get_default().auth_token = "31y03xgLo8cpZ0WujlWkTCT34qK_86cXFLfdH2c3gX3SEezaz"
|
||||||
|
|
||||||
# ngrok config add-authtoken 31y03xgLo8cpZ0WujlWkTCT34qK_86cXFLfdH2c3gX3SEezaz
|
# 1. Download Model
|
||||||
# ngrop http --url=pegasus-working-bison.ngrok-free.app 8000
|
# python downloadModel.py
|
||||||
|
|
||||||
# Command to run with splunk observability
|
# 2. Command to run with splunk observability
|
||||||
# opentelemetry-instrument python server.py
|
# opentelemetry-instrument python server.py
|
||||||
|
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
# 3. Command to run ngrok
|
||||||
|
# ngrok http --url=pegasus-working-bison.ngrok-free.app 8000
|
||||||
|
|
||||||
|
# ngrok config add-authtoken 31y03xgLo8cpZ0WujlWkTCT34qK_86cXFLfdH2c3gX3SEezaz
|
||||||
|
# ngrop http --url=pegasus-working-bison.ngrok-free.app 8000
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
# Logging
|
# Logging
|
||||||
|
|||||||
Reference in New Issue
Block a user