-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (46 loc) · 1.81 KB
/
main.py
File metadata and controls
55 lines (46 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from add_image_to_production import add_image_to_production
from checker import checker
from create_youtube_video import create_youtube_video
from dir_checker import dir_checker
from flask_client import flask_client
from image_generation_custom import image_generator_custom
from welcome import welcome
app, jsonify,request = flask_client()
INTERVAL = 5
MAXTOKENS = 2500
@app.route('/api/create/1', methods=['GET'])
def api_check1():
url = request.args.get('url')
if not url:
return jsonify({"error": "url parameter is missing"}), 400
channel_type = request.args.get('channel_type')
if not channel_type:
return jsonify({"error": "channel_type parameter is missing"}), 400
dir_checker()
checker()
create_youtube_video(INTERVAL, MAXTOKENS, url, channel_type)
return jsonify({"url": url}), 200
@app.route('/api/create/2', methods=['GET'])
def api_check2():
channel_type = request.args.get('channel_type')
if not channel_type:
return jsonify({"error": "channel_type parameter is missing"}), 400
image_amount = request.args.get('image_amount')
if not image_amount:
return jsonify({"error": "image_amount parameter is missing"}), 400
image_generator_custom(channel_type, int(image_amount))
return jsonify({"message": "Method 2"}), 200
@app.route('/api/create/3', methods=['GET'])
def api_check3():
channel_type = request.args.get('channel_type')
if not channel_type:
return jsonify({"error": "channel_type parameter is missing"}), 400
add_image_to_production(channel_type, "generated-images")
return jsonify({"message": "Method 3"}), 200
@app.route('/api/method/4', methods=['GET'])
def api_check4():
dir_checker()
checker()
return jsonify({"message": "Method 4"}), 200
if __name__ == "__main__":
app.run(debug=True)