nitti510x/ai-agent-marketing-research-api
0
Market Research API
A FastAPI-based market research API that combines news articles and AI analysis to provide market insights.
Features
- News article aggregation using NewsAPI
- AI-powered analysis using OpenAI's GPT-3.5
- RESTful API endpoints
- Docker support for easy deployment
API Endpoints
- POST /analyze: Analyze market trends for a given topic
- Request body:
{
"topic": "string",
"days": "integer (default: 7)"
}- Response:
{
"summary": "string",
"trends": ["string"],
"recommendations": ["string"]
}Environment Variables
Create a .env file with:
OPENAI_API_KEY=your_openai_api_key
NEWS_API_KEY=your_newsapi_keyLocal Development
- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the API:
python app.pyHugging Face Deployment
- Create a new Space on Hugging Face
- Choose "Docker" as the Space SDK
- Add your environment variables in the Space settings
- Push your code to the Space repository
The API will be automatically deployed and available at your Space URL.
