beweinreich's picture
first
1727a7e
raw
history blame
1.04 kB
from flask import Flask, request, jsonify
from audio_analyzer import AudioAnalyzer
from video_analyzer import VideoAnalyzer
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello_world():
return jsonify({"message": "Hello, World!"})
@app.route('/v1/analyze_audio', methods=['POST'])
def analyze_audio():
data = request.get_json()
audio_url = data.get('audio_url')
if not audio_url:
return jsonify({"error": "audio_url is required"}), 400
analyzer = AudioAnalyzer(media_url=audio_url, media_type="audio")
traits = analyzer.retrieve_traits()
return jsonify(traits)
@app.route('/v1/analyze_video', methods=['POST'])
def analyze_video():
data = request.get_json()
video_url = data.get('video_url')
if not video_url:
return jsonify({"error": "video_url is required"}), 400
analyzer = VideoAnalyzer(video_url=video_url)
traits = analyzer.retrieve_traits()
return jsonify(traits)
if __name__ == '__main__':
app.run(debug=True)