Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,10 +9,10 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
-
# Sentiment Analysis
|
| 13 |
|
| 14 |
## Project Objectives
|
| 15 |
-
The goal of
|
| 16 |
- Analyzes the sentiment of user-provided text, classifying it into a 1-5 star rating.
|
| 17 |
- Provides tailored recommendations based on the detected sentiment.
|
| 18 |
- Generates audio versions of the recommendations for an enhanced user experience.
|
|
@@ -22,7 +22,7 @@ The goal of this project is to create an interactive web application that:
|
|
| 22 |
This app is designed as a demo to showcase sentiment analysis capabilities, making it accessible via Hugging Face Spaces for easy sharing and testing.
|
| 23 |
|
| 24 |
## Description of Implemented Pipelines
|
| 25 |
-
|
| 26 |
|
| 27 |
1. **Sentiment Analysis Pipeline**:
|
| 28 |
- **Technology**: Uses the `transformers` library from Hugging Face with the `pipeline` utility.
|
|
@@ -38,8 +38,8 @@ The application consists of two main pipelines integrated into a Gradio interfac
|
|
| 38 |
These pipelines are combined in a single function (`analyze_sentiment`), which processes the input, generates the recommendation, and returns all outputs for display.
|
| 39 |
|
| 40 |
## Instructions for Using the Interface
|
| 41 |
-
1. **Access
|
| 42 |
-
- Visit the Hugging Face Space URL (e.g., `https://huggingface.co/spaces/<your-username
|
| 43 |
|
| 44 |
2. **Input Your Comment**:
|
| 45 |
- In the "Your Comment" textbox, type a short review or opinion (e.g., "The product is amazing!" or "الخدمة سيئة جداً").
|
|
@@ -57,13 +57,13 @@ These pipelines are combined in a single function (`analyze_sentiment`), which p
|
|
| 57 |
- **Audio Recommendation**: Play the audio version of the recommendation.
|
| 58 |
|
| 59 |
6. **Try Examples**:
|
| 60 |
-
- Use the provided examples at the bottom (e.g., "The product is amazing!" or "منتج جيد نوعاً ما") to test
|
| 61 |
|
| 62 |
-
**Note**:
|
| 63 |
|
| 64 |
## Justifications for Model and Pipeline Choices
|
| 65 |
- **Model: `nlptown/bert-base-multilingual-uncased-sentiment`**:
|
| 66 |
-
- **Why Chosen**: This BERT-based model is pre-trained and fine-tuned for sentiment analysis on a 1-5 star scale, aligning perfectly with
|
| 67 |
- **Advantages**: High accuracy, robust handling of diverse text inputs, and availability on Hugging Face’s model hub for easy integration.
|
| 68 |
- **Alternative Considered**: A simpler model (e.g., VADER) was an option but lacks multilingual support and nuanced star ratings.
|
| 69 |
|
|
@@ -72,7 +72,7 @@ These pipelines are combined in a single function (`analyze_sentiment`), which p
|
|
| 72 |
- **Advantages**: Pre-built tokenization and prediction steps, making it ideal for quick deployment.
|
| 73 |
|
| 74 |
- **Text-to-Speech Pipeline (`gTTS`)**:
|
| 75 |
-
- **Why Chosen**: Lightweight, free, and supports Arabic and English, matching
|
| 76 |
- **Advantages**: No need for complex setup or API keys (unlike alternatives like AWS Polly), making it suitable for a demo app.
|
| 77 |
- **Trade-off**: Audio quality is basic, but sufficient for this use case.
|
| 78 |
|
|
@@ -81,7 +81,7 @@ These pipelines are combined in a single function (`analyze_sentiment`), which p
|
|
| 81 |
- **Advantages**: Free hosting, quick setup, and a professional look with minimal effort.
|
| 82 |
|
| 83 |
## Bilingual Implementation
|
| 84 |
-
|
| 85 |
- **Sentiment Analysis**: The `nlptown/bert-base-multilingual-uncased-sentiment` model is multilingual, trained on diverse datasets, and can process text in either language without additional configuration. It detects sentiment regardless of the input language.
|
| 86 |
- **Recommendations**:
|
| 87 |
- Predefined recommendations are stored in a dictionary with separate entries for Arabic and English.
|
|
@@ -91,16 +91,14 @@ The app fully supports bilingual functionality for Arabic and English:
|
|
| 91 |
- This ensures the audio output aligns with the selected language.
|
| 92 |
- **Interface**: The UI uses the `Tajawal` font (via CSS), which supports Arabic script and fallback to `Arial` for English, ensuring readability in both languages.
|
| 93 |
|
| 94 |
-
**Justification**: Bilingual support was a core requirement to make
|
| 95 |
|
| 96 |
---
|
| 97 |
|
| 98 |
## Setup for Hugging Face Spaces
|
| 99 |
-
To deploy
|
| 100 |
-
1. Upload `app.py` (the main script) and `requirements.txt` (dependencies: `gradio`, `transformers`, `gtts`, `torch`) to a Hugging Face Space.
|
| 101 |
-
2. Set the hardware to "CPU Basic" (free tier, 2 vCPUs, 16 GB RAM), sufficient for
|
| 102 |
-
3. The Space will build and host
|
| 103 |
|
| 104 |
-
For more details, see the deployment logs or contact the repository owner.
|
| 105 |
-
|
| 106 |
-
---
|
|
|
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
+
# SAFP: Sentiment Analysis Feedback Platform
|
| 13 |
|
| 14 |
## Project Objectives
|
| 15 |
+
The goal of SAFP (Sentiment Analysis Feedback Platform) is to create an interactive web application that:
|
| 16 |
- Analyzes the sentiment of user-provided text, classifying it into a 1-5 star rating.
|
| 17 |
- Provides tailored recommendations based on the detected sentiment.
|
| 18 |
- Generates audio versions of the recommendations for an enhanced user experience.
|
|
|
|
| 22 |
This app is designed as a demo to showcase sentiment analysis capabilities, making it accessible via Hugging Face Spaces for easy sharing and testing.
|
| 23 |
|
| 24 |
## Description of Implemented Pipelines
|
| 25 |
+
SAFP consists of two main pipelines integrated into a Gradio interface:
|
| 26 |
|
| 27 |
1. **Sentiment Analysis Pipeline**:
|
| 28 |
- **Technology**: Uses the `transformers` library from Hugging Face with the `pipeline` utility.
|
|
|
|
| 38 |
These pipelines are combined in a single function (`analyze_sentiment`), which processes the input, generates the recommendation, and returns all outputs for display.
|
| 39 |
|
| 40 |
## Instructions for Using the Interface
|
| 41 |
+
1. **Access SAFP**:
|
| 42 |
+
- Visit the Hugging Face Space URL (e.g., `https://huggingface.co/spaces/<your-username>/SAFP` once deployed).
|
| 43 |
|
| 44 |
2. **Input Your Comment**:
|
| 45 |
- In the "Your Comment" textbox, type a short review or opinion (e.g., "The product is amazing!" or "الخدمة سيئة جداً").
|
|
|
|
| 57 |
- **Audio Recommendation**: Play the audio version of the recommendation.
|
| 58 |
|
| 59 |
6. **Try Examples**:
|
| 60 |
+
- Use the provided examples at the bottom (e.g., "The product is amazing!" or "منتج جيد نوعاً ما") to test SAFP quickly.
|
| 61 |
|
| 62 |
+
**Note**: SAFP may take a few seconds to load the model on first use.
|
| 63 |
|
| 64 |
## Justifications for Model and Pipeline Choices
|
| 65 |
- **Model: `nlptown/bert-base-multilingual-uncased-sentiment`**:
|
| 66 |
+
- **Why Chosen**: This BERT-based model is pre-trained and fine-tuned for sentiment analysis on a 1-5 star scale, aligning perfectly with SAFP’s goal of rating user comments. Its multilingual support handles both Arabic and English effectively.
|
| 67 |
- **Advantages**: High accuracy, robust handling of diverse text inputs, and availability on Hugging Face’s model hub for easy integration.
|
| 68 |
- **Alternative Considered**: A simpler model (e.g., VADER) was an option but lacks multilingual support and nuanced star ratings.
|
| 69 |
|
|
|
|
| 72 |
- **Advantages**: Pre-built tokenization and prediction steps, making it ideal for quick deployment.
|
| 73 |
|
| 74 |
- **Text-to-Speech Pipeline (`gTTS`)**:
|
| 75 |
+
- **Why Chosen**: Lightweight, free, and supports Arabic and English, matching SAFP’s bilingual requirements. It integrates seamlessly with Gradio’s audio output.
|
| 76 |
- **Advantages**: No need for complex setup or API keys (unlike alternatives like AWS Polly), making it suitable for a demo app.
|
| 77 |
- **Trade-off**: Audio quality is basic, but sufficient for this use case.
|
| 78 |
|
|
|
|
| 81 |
- **Advantages**: Free hosting, quick setup, and a professional look with minimal effort.
|
| 82 |
|
| 83 |
## Bilingual Implementation
|
| 84 |
+
SAFP fully supports bilingual functionality for Arabic and English:
|
| 85 |
- **Sentiment Analysis**: The `nlptown/bert-base-multilingual-uncased-sentiment` model is multilingual, trained on diverse datasets, and can process text in either language without additional configuration. It detects sentiment regardless of the input language.
|
| 86 |
- **Recommendations**:
|
| 87 |
- Predefined recommendations are stored in a dictionary with separate entries for Arabic and English.
|
|
|
|
| 91 |
- This ensures the audio output aligns with the selected language.
|
| 92 |
- **Interface**: The UI uses the `Tajawal` font (via CSS), which supports Arabic script and fallback to `Arial` for English, ensuring readability in both languages.
|
| 93 |
|
| 94 |
+
**Justification**: Bilingual support was a core requirement to make SAFP accessible to Arabic and English speakers. The chosen tools naturally support this without needing separate models or complex logic, keeping the implementation efficient and maintainable.
|
| 95 |
|
| 96 |
---
|
| 97 |
|
| 98 |
## Setup for Hugging Face Spaces
|
| 99 |
+
To deploy SAFP:
|
| 100 |
+
1. Upload `app.py` (the main script) and `requirements.txt` (dependencies: `gradio`, `transformers`, `gtts`, `torch`) to a Hugging Face Space named "SAFP".
|
| 101 |
+
2. Set the hardware to "CPU Basic" (free tier, 2 vCPUs, 16 GB RAM), sufficient for SAFP’s lightweight needs.
|
| 102 |
+
3. The Space will build and host SAFP, providing a public URL.
|
| 103 |
|
| 104 |
+
For more details, see the deployment logs or contact the repository owner.
|
|
|
|
|
|