Sabih555 commited on
Commit
a9810af
·
1 Parent(s): e015b22

Add application file

Browse files
Files changed (3) hide show
  1. Dockerfile +11 -0
  2. app.py +17 -0
  3. requirements.txt +8 -0
Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM python:3.10-slim
3
+
4
+ WORKDIR /python-docker
5
+
6
+ COPY requirements.txt requirements.txt
7
+ RUN pip3 install -r requirements.txt
8
+
9
+ COPY . .
10
+
11
+ CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, jsonify
2
+
3
+ app = Flask(__name__)
4
+
5
+ @app.route('/modify_json', methods=['POST'])
6
+ def modify_json():
7
+ # Get JSON input from the request
8
+ input_json = request.get_json()
9
+
10
+ # Modify the JSON (for demonstration, simply adding a key 'modified' with value True)
11
+ input_json['modified'] = True
12
+
13
+ # Return modified JSON as response
14
+ return jsonify(input_json)
15
+
16
+ if __name__ == '__main__':
17
+ app.run(debug=True) # Run the app in debug mode
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ blinker==1.7.0
2
+ click==8.1.7
3
+ colorama==0.4.6
4
+ Flask==3.0.2
5
+ itsdangerous==2.1.2
6
+ Jinja2==3.1.3
7
+ MarkupSafe==2.1.5
8
+ Werkzeug==3.0.1