gamingflexer commited on
Commit
99e8d72
1 Parent(s): 2d1772e

files added

Browse files
Files changed (3) hide show
  1. Dockerfile +23 -0
  2. app.py +32 -0
  3. requirements.txt +1 -0
Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Copy the requirements file to the working directory
8
+ COPY requirements.txt .
9
+
10
+ # Install the required packages
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+
13
+ # Copy the Flask app code to the working directory
14
+ COPY app.py .
15
+
16
+ # Expose the port on which the app will run
17
+ EXPOSE 5000
18
+
19
+ # Set the environment variable for Flask
20
+ ENV FLASK_APP=app.py
21
+
22
+ # Run the Flask app
23
+ CMD ["flask", "run", "--host=0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, jsonify, request
2
+
3
+ app = Flask(__name__)
4
+
5
+ @app.route('/api/podcasts', methods=['POST'])
6
+ def create_podcast():
7
+ data = request.json
8
+ links = data.get('links')
9
+ user_id = data.get('user_id')
10
+
11
+ # Dummy logic to create a podcast
12
+ if links and user_id:
13
+ # Assuming the podcast is successfully created and assigned an ID of 2
14
+ response = {
15
+ "data": {
16
+ "id": 2
17
+ },
18
+ "success": True,
19
+ "message": "Podcast created successfully"
20
+ }
21
+ return jsonify(response), 200
22
+ else:
23
+ response = {
24
+ "data": {},
25
+ "success": False,
26
+ "message": "Podcast creation failed"
27
+ }
28
+ return jsonify(response), 500
29
+
30
+ if __name__ == '__main__':
31
+ app.run(debug=True)
32
+
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ flask