Asmita2682hshs commited on
Commit
3170f76
·
verified ·
1 Parent(s): 885c1e6

Upload 4 files

Browse files
Files changed (3) hide show
  1. Dockerfile +21 -0
  2. hf_runner.py +20 -0
  3. requirements.txt +5 -0
Dockerfile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM mcr.microsoft.com/playwright/python:v1.40.0-jammy
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ # Copy worker and setup
10
+ COPY worker.py .
11
+ COPY hf_runner.py .
12
+
13
+ # Environment Variables
14
+ ENV REDIS_HOST=13.235.87.209
15
+ ENV REDIS_PORT=6379
16
+ ENV API_URL=http://13.235.87.209:8000
17
+
18
+ # Hugging Face needs port 7860
19
+ EXPOSE 7860
20
+
21
+ CMD ["python", "hf_runner.py"]
hf_runner.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import subprocess
3
+ import threading
4
+ from flask import Flask
5
+
6
+ app = Flask(__name__)
7
+
8
+ @app.route('/')
9
+ def home():
10
+ return "Worker is Running! 🚀"
11
+
12
+ def run_worker():
13
+ print("Starting Worker...")
14
+ subprocess.run(["python", "worker.py"])
15
+
16
+ if __name__ == "__main__":
17
+ # Start worker in background
18
+ threading.Thread(target=run_worker, daemon=True).start()
19
+ # Start dummy server for Hugging Face health check
20
+ app.run(host="0.0.0.0", port=7860)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ playwright>=1.40.0
2
+ redis
3
+ requests
4
+ flask
5
+ pyotp