Spaces:
Sleeping
Sleeping
from flask import Flask, request, jsonify | |
from audio_analyzer import AudioAnalyzer | |
from video_analyzer import VideoAnalyzer | |
app = Flask(__name__) | |
def hello_world(): | |
return jsonify({"message": "Hello, World!"}) | |
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) | |
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) | |