mckabue commited on
Commit
a5c2bee
·
1 Parent(s): df8f0c0

Test Flask In Huggingface: https://www.youtube.com/watch?v=pWnE9FHnGcQ

Browse files
Files changed (3) hide show
  1. Dockerfile +16 -0
  2. app.py +11 -0
  3. requirements.txt +4 -0
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.9
5
+
6
+ RUN useradd -m -u 1000 user
7
+
8
+ WORKDIR /app
9
+
10
+ COPY --chown=user ./requirements.txt requirements.txt
11
+
12
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
+
14
+ COPY --chown=user . /app
15
+
16
+ CMD ["gunocorn", "-b", "0.0.0.0:7860", "app:app"]
app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask
2
+
3
+ app = Flask(__name__)
4
+
5
+ @app.route('/')
6
+ def hello_world():
7
+ return 'Hello, World!'
8
+
9
+ @app.route('/video_id/<video_id>')
10
+ def get_video_id(video_id):
11
+ return f'video_id = {video_id}!'
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ pytube==15.0.0
2
+ pandas==2.2.2
3
+ Flask==3.0.3
4
+ gunicorn==22.0.0