RawadAlghamdi commited on
Commit
d93accb
·
verified ·
1 Parent(s): 3eaef47

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -1
README.md CHANGED
@@ -10,4 +10,67 @@ pinned: false
10
  license: apache-2.0
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  license: apache-2.0
11
  ---
12
 
13
+ # Sentiment Analyzer
14
+
15
+ ## Overview
16
+ Welcome to **Sentiment Analyzer**, a text-to-text AI project developed as Part 1 of the AI Integration Project using Hugging Face pipelines and Gradio. This application takes user input in either Arabic or English, analyzes the sentiment expressed in the text, and returns a sentiment label (e.g., "1 star" to "5 stars") along with a confidence score. The goal is to demonstrate a functional, bilingual sentiment analysis pipeline integrated with an interactive Gradio interface, deployed on Hugging Face Spaces.
17
+
18
+ ## Project Objectives
19
+ - Build a text-to-text pipeline using a Hugging Face model for sentiment analysis.
20
+ - Integrate the pipeline with a user-friendly Gradio interface.
21
+ - Deploy the solution on Hugging Face Spaces for accessibility.
22
+ - Ensure support for both Arabic and English inputs, showcasing bilingual capabilities.
23
+
24
+ ## Implemented Pipeline
25
+ - **Task**: Sentiment Analysis (Text-to-Text)
26
+ - **Model**: `nlptown/bert-base-multilingual-uncased-sentiment`
27
+ - **Framework**: Hugging Face Transformers
28
+ - **Interface**: Gradio
29
+ - **Input**: User-provided text (comments or reviews) in Arabic or English.
30
+ - **Output**: Sentiment label (e.g., "1 star", "2 stars", etc.) and a confidence score (0 to 1).
31
+
32
+ The pipeline processes text input, leverages a pretrained multilingual model to classify sentiment, and displays the results in an intuitive format via Gradio.
33
+
34
+ ## Instructions for Using the Interface
35
+ 1. **Enter Your Comment**: Type your text (e.g., a review or opinion) into the text box.
36
+ 2. **Select Language**: Choose "Arabic" or "English" from the radio buttons to indicate your input language.
37
+ 3. **Click Analyze**: Press the "Analyze" button to process your text.
38
+ 4. **View Results**: The sentiment label (e.g., "4 stars") appears in the "Sentiment" box, and the confidence score (between 0 and 1) is shown on the slider.
39
+
40
+ ### Example Inputs
41
+ - English: "The product is amazing!" → "5 stars" (Positive)
42
+ - Arabic: "الخدمة سيئة جداً" → "1 star" (Negative)
43
+ - Try the built-in examples below the interface for a quick demo!
44
+
45
+ ## Model and Pipeline Choices
46
+ - **Model Selection**: The `nlptown/bert-base-multilingual-uncased-sentiment` model was chosen because:
47
+ - It’s pretrained on a large, diverse dataset, enabling accurate sentiment classification.
48
+ - It supports multiple languages, including Arabic and English, aligning with the bilingual requirement.
49
+ - It outputs sentiment as star ratings (1 to 5), which are user-friendly and widely understood.
50
+ - **Pipeline Justification**: The Hugging Face `pipeline` API simplifies integration, providing a robust, out-of-the-box solution for sentiment analysis. Paired with Gradio, it ensures an interactive experience without complex custom coding.
51
+ - **Performance**: The model runs efficiently, with GPU support enabled if available (via PyTorch), ensuring quick responses for users.
52
+
53
+ ## Bilingual Implementation
54
+ The project fully supports both Arabic and English:
55
+ - **Model Capability**: The underlying BERT-based model is multilingual and pretrained on texts including Arabic and English, allowing it to process both languages natively without additional translation steps.
56
+ - **Interface Design**: The Gradio interface uses the "Tajawal" font for Arabic readability alongside Arial for English, ensuring a seamless experience for bilingual users.
57
+ - **Testing**: The pipeline has been tested with Arabic and English inputs (see examples above), confirming consistent performance across both languages.
58
+
59
+ No justification for excluding bilingual support is needed, as it’s fully implemented.
60
+
61
+ ## Deployment
62
+ - **Platform**: Hosted on Hugging Face Spaces.
63
+ - **Setup**: The project uses a Gradio app (`app.py`) with dependencies listed in `requirements.txt` (`gradio`, `transformers`, `torch`).
64
+ - **Access**: Publicly available via this Space’s URL—feel free to try it out!
65
+
66
+ ## How to Run Locally (Optional)
67
+ If you’d like to run this project locally:
68
+ 1. Clone the repository from this Space.
69
+ 2. Install dependencies: `pip install -r requirements.txt`.
70
+ 3. Run the app: `python app.py`.
71
+ 4. Open the displayed local URL in your browser.
72
+
73
+ ## Contact
74
+ For questions or feedback, reach out to `Tuwaigcoursega@gmail.com`.
75
+
76
+ Thank you for exploring Sentiment Analyzer—we hope you find it insightful and intuitive!