Spaces:
Running
Running
File size: 3,232 Bytes
f7a79f5 3c7d0f6 1213c8d f7a79f5 3c7d0f6 1213c8d 3c7d0f6 1213c8d 3c7d0f6 1213c8d 3c7d0f6 1213c8d 3c7d0f6 1213c8d 3c7d0f6 1213c8d 3c7d0f6 1213c8d 3c7d0f6 f7a79f5 3c7d0f6 1213c8d 3c7d0f6 1213c8d 3c7d0f6 1213c8d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
---
title: nat-ad
sdk: docker
app_port: 7860
---
# Social Media Ads Creator
This project leverages AI agents to automatically generate social media ad copy for products from their URLs.
## How it Works
The system uses a Gradio interface (`app.py`) with two main tabs:
1. **Social Media Ad Generator:** This tab takes product URLs and other parameters as input. Behind the scenes, a "crew" of AI agents, each with a specific role, processes this information:
* **Product Analyst:** This agent scrapes a product URL to extract key information like the product name, features, price, and any available discounts. It also uses a tool to shorten the URL.
* **Social Media Copywriter:** This agent takes the product information and crafts a compelling social media post in Portuguese, tailored for platforms like WhatsApp. The post includes a call to action, emojis, and the shortened URL.
2. **Fragrantica Website Analyzer:** This new tab allows users to input a Fragrantica.com URL for a perfume. A dedicated "FragranticaCrew" analyzes the webpage using a stealthy web scraping tool (`StealthScrapeTool`) to bypass anti-bot measures. The crew then generates a comprehensive perfume analysis report.
* **Expert Perfume Analyst and Web Data Extractor:** This agent extracts detailed perfume information (notes, accords, longevity, sillage, similar fragrances, reviews) from the Fragrantica page.
* **Fragrance Expert Woman and Perfume Analysis Reporter:** This agent synthesizes the extracted data into a human-friendly report, including graded evaluations and personalized recommendations.
## Setup and Usage
1. **Prerequisites:**
* Docker installed
* An OpenAI API key
* A Natura API token (for the URL shortener)
2. **Installation & Execution (Docker):**
* Build the Docker image:
```bash
docker build -t natura-ads .
```
* Run the Docker container, mapping port 7860 and passing API keys as environment variables:
```bash
docker run -p 7860:7860 -e OPENAI_API_KEY="your_openai_api_key" -e NATURA_API_TOKEN="your_natura_api_token" -e OPENAI_BASE_URL="your_openai_base_url" -e OPENAI_MODEL_NAME="your_openai_model_name" natura-ads
```
* Access the Gradio interface in your web browser at `http://localhost:7860`.
## Key Files
* `app.py`: The Gradio application that provides the user interface.
* `social_media_crew.py`: Defines the AI agents and their tasks for social media ad generation.
* `fragrantica_crew.py`: Defines the AI agents and their tasks for Fragrantica website analysis.
* `stealth_scrape_tool.py`: A custom tool for stealthy web scraping using Playwright.
* `shortener_tool.py`: A custom tool for shortening URLs.
* `Dockerfile`: Defines the Docker image for deploying the application.
* `.env`: The configuration file for API keys (used for local development, environment variables preferred for Docker).
* `pyproject.toml`: The project's metadata and dependencies.
# Roadmap
- [x] Add support for any model/api key supported by LiteLLM.
- [x] Add Fragrantica support, where user will input a Fragrantica URL and the agent will extract and generate a Perfume Analysis report.
|