Sign inSign up

adithya7reddy/safa

By adithya7reddy

Updated 11 months ago

SAFA: AI-powered customer feedback analyser

Image
API management
Data science
Web analytics
0

263

adithya7reddy/safa repository overview

SAFA - Sentiment Analysis & Feedback Analyzer

A Flask-based web application that analyzes customer reviews using AI-powered sentiment analysis, categorization, and generates actionable insights.

Features

  • 📊 Review Summarization: Automatically summarizes customer reviews
  • 🏷️ Smart Tagging: Categorizes reviews into relevant themes
  • 😊 Sentiment Analysis: Identifies positive, negative, and neutral sentiments
  • 📈 Satisfaction Scoring: Calculates customer satisfaction scores (1-100)
  • 📝 Analysis Reports: Generates comprehensive business analysis reports
  • 💡 Improvement Suggestions: Provides actionable recommendations

Quick Start

Prerequisites
Pull the image

You need to have the image in your local host system to create an instance of the image (container)

docker pull adithya7reddy/safa:2.0
Run the Container
docker run -d \
  -p 8000:5000 \
  -v $(pwd)/uploads:/app/uploads \
  -e summarize_key="your_groq_api_key" \
  -e tag_key="your_groq_api_key" \
  -e analysis_key="your_groq_api_key" \
  -e improvements_key="your_groq_api_key" \
  --name safa_container \
  adithya7reddy/safa:2.0
Access the Application

Open your browser and navigate to: http://localhost:8000

Environment Variables

The application requires 4 API keys and 4 model names (with defaults):

VariableDescriptionDefault Value
summarize_keyGroq API key for summarization(Required)
summarize_modelModel for summarizationllama-3.3-70b-versatile
tag_keyGroq API key for tagging(Required)
tag_modelModel for taggingllama-3.3-70b-versatile
analysis_keyGroq API key for analysis(Required)
analysis_modelModel for analysisqwen/qwen3-32b
improvements_keyGroq API key for suggestions(Required)
improvements_modelModel for suggestionsqwen/qwen3-32b
Using Different Models

You can specify different AI models for each function:

docker run -d \
  -p 8000:5000 \
  -v $(pwd)/uploads:/app/uploads \
  -e summarize_key="gsk_xxxxx" \
  -e summarize_model="llama-3.3-70b-versatile" \
  -e tag_key="gsk_xxxxx" \
  -e tag_model="mixtral-8x7b-32768" \
  -e analysis_key="gsk_xxxxx" \
  -e analysis_model="qwen/qwen3-32b" \
  -e improvements_key="gsk_xxxxx" \
  -e improvements_model="gemma2-9b-it" \
  --name safa_container \
  adithya7reddy/safa:2.0

Using Environment File

For easier management, create a .env file:

summarize_key=your_api_key1_here
summarize_model=llama-3.3-70b-versatile
tag_key=your_api_key2_here
tag_model=llama-3.3-70b-versatile
analysis_key=your_api_key3_here
analysis_model=qwen/qwen3-32b
improvements_key=your_api_key4_here
improvements_model=qwen/qwen3-32b

Then run:

docker run -d
-p 8000:5000
-v $(pwd)/uploads:/app/uploads
--env-file .env
--name safa_container
adithya7reddy/safa:2.0

Input Format

Upload an Excel file (.xlsx) with the following columns:

  • Text: Customer review text
  • Rating: Numerical rating (optional)

Example:

TextRating
Great product, fast delivery!5
Poor quality, not worth the price2

Supported Models

Compatible Groq models include:

  • llama-3.3-70b-versatile
  • llama-3.1-70b-versatile
  • mixtral-8x7b-32768
  • gemma2-9b-it
  • qwen/qwen3-32b

Check Groq documentation for the latest available models.

Ports

  • Container Port: 5000
  • Host Port: 8000 (configurable with -p flag)

Volume Mounting

The -v $(pwd)/uploads:/app/uploads flag ensures uploaded files persist between container restarts.

Container Management

Stop the container:

docker stop safa_container

Start the container:

docker start safa_container

View logs:

docker logs safa_container

Remove the container:

docker rm safa_container

Troubleshooting

Problem: Application won't start

  • Solution: Check if all required API keys are provided and all the requirements are met
  • Run docker logs safa_container to see error messages

Problem: Cannot access localhost:8000

  • Solution: Ensure port 8000 is not in use by another application
  • Change the port: -p 9000:5000

Problem: Pydantic errors

  • Solution: This version includes Pydantic 2.9.2 for compatibility

Technology Stack

  • Backend: Flask 3.1.0
  • AI/ML: LangChain, Groq API
  • Data Processing: Pandas, NumPy
  • Containerization: Docker

Version History

  • 2.0: Environment variable support for API keys and models
  • 1.0: Initial release for testing - Recommended not to use

License

This project is open source and available for educational purposes.

Support

For issues or questions, please open an issue on the GitHub repository: Adithya2369/safa_public

Tag summary

Content type

Image

Digest

sha256:3eb01466e

Size

242.2 MB

Last updated

11 months ago

docker pull adithya7reddy/safa:2.2