Spaces:
Sleeping
Sleeping
Download api.py from shareefmx/News-Summarization: direct link, hf CLI and curl.
- Browser
- Download file 764 Bytes
-
https://huggingface.co/spaces/shareefmx/News-Summarization/resolve/main/api.py
- Command line
-
hf download hf://spaces/shareefmx/News-Summarization/api.py
-
curl -L -o api.py https://huggingface.co/spaces/shareefmx/News-Summarization/resolve/main/api.py
764 Bytes
| from flask import Flask, request, jsonify | |
| from utils import fetch_news, analyze_sentiment, comparative_analysis, generate_tts | |
| app = Flask(__name__) | |
| def get_news(): | |
| company = request.args.get('company') | |
| articles = fetch_news(company) | |
| return jsonify(articles) | |
| def get_sentiment(): | |
| data = request.get_json() | |
| sentiment_result = analyze_sentiment(data["text"]) | |
| return jsonify({"sentiment": sentiment_result}) | |
| def get_tts(): | |
| data = request.get_json() | |
| generate_tts(data["text"]) | |
| return jsonify({"message": "TTS generated successfully"}) | |
| if __name__ == '__main__': | |
| app.run(debug=True) | |