CoolFace
Apppublic

nitti510x/ai-agent-marketing-research-api

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
App README

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:
json
    {
        "topic": "string",
        "days": "integer (default: 7)"
    }
  • —Response:
json
    {
        "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_key

Local Development

  1. 1.Create virtual environment:
bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. 1.Install dependencies:
bash
pip install -r requirements.txt
  1. 1.Run the API:
bash
python app.py

Hugging Face Deployment

  1. 1.Create a new Space on Hugging Face
  2. 2.Choose "Docker" as the Space SDK
  3. 3.Add your environment variables in the Space settings
  4. 4.Push your code to the Space repository

The API will be automatically deployed and available at your Space URL.