Spaces:
Sleeping
Sleeping
Vlad Bastina commited on
Commit ·
bf5e28e
1
Parent(s): 3f69023
style change
Browse files- README.md +0 -46
- streamlit_app.py +3 -1
- style.css +10 -6
README.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
| 1 |
-
# Sentiment Analysis and Voice Recorder App
|
| 2 |
-
|
| 3 |
-
This project is a **Streamlit-based application** that combines voice recording and sentiment analysis. It allows users to record audio, transcribe the speech into text, analyze its sentiment, and visualize the sentiment results as a histogram. Sentiment scores range from -10 (furious) to +10 (peaceful).
|
| 4 |
-
|
| 5 |
-
---
|
| 6 |
-
|
| 7 |
-
## Features
|
| 8 |
-
- **Voice Recording**: Users can record audio directly in the app.
|
| 9 |
-
- **Speech-to-Text**: Converts recorded audio into text using a transcription service.
|
| 10 |
-
- **Sentiment Analysis**: Analyzes the sentiment of the conversation using a pre-trained model or API (e.g., Gemini).
|
| 11 |
-
- **Histogram Visualization**: Displays the sentiment scores of individual sentences in a histogram.
|
| 12 |
-
- **Export**: Saves the histogram as a PNG file.
|
| 13 |
-
|
| 14 |
-
---
|
| 15 |
-
|
| 16 |
-
## How to setup
|
| 17 |
-
1. Create environment and install dependencies
|
| 18 |
-
```bash
|
| 19 |
-
conda create -n setiment python=3.12
|
| 20 |
-
conda activate setiment
|
| 21 |
-
pip install -r requirements.txt
|
| 22 |
-
```
|
| 23 |
-
|
| 24 |
-
2. Create secrets.toml in the .streamlit folder and insert GOOGLE_API_KEY and GOOGLE_APPLICATION_CREDENTIALS
|
| 25 |
-
|
| 26 |
-
## How to run
|
| 27 |
-
|
| 28 |
-
```bash
|
| 29 |
-
streamlit run streamlit_app.py
|
| 30 |
-
```
|
| 31 |
-
|
| 32 |
-
## How it works
|
| 33 |
-
|
| 34 |
-
**streamlit_app.py** is the ui in streamlit
|
| 35 |
-
|
| 36 |
-
**translation.py** gets the transcription from the recorded audio using google speech-to-text api
|
| 37 |
-
|
| 38 |
-
**gemini_call.py** calls gemini on transcription in order to perform the sentiment analysis and makes a plot which is saved in a png
|
| 39 |
-
|
| 40 |
-
**sentiment_analysis.py** is combining the 2 files above
|
| 41 |
-
|
| 42 |
-
## Where to find it
|
| 43 |
-
|
| 44 |
-
Path on **rtx** : /home/vladp/Projects/sentimentAnalysis/
|
| 45 |
-
|
| 46 |
-
Env : setiment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
streamlit_app.py
CHANGED
|
@@ -63,7 +63,9 @@ def display_message(role, content, image_path=None):
|
|
| 63 |
|
| 64 |
def main():
|
| 65 |
"""Main function that loops and can record audio and dispaly the messages from gemini"""
|
| 66 |
-
st.title("
|
|
|
|
|
|
|
| 67 |
|
| 68 |
logo_path = "zega_logo.svg"
|
| 69 |
if os.path.exists(logo_path):
|
|
|
|
| 63 |
|
| 64 |
def main():
|
| 65 |
"""Main function that loops and can record audio and dispaly the messages from gemini"""
|
| 66 |
+
st.title("Verbal Sentiment Tracker")
|
| 67 |
+
|
| 68 |
+
st.write("This demo lets you record your voice, automatically transcribes the audio, and analyzes the emotional tone of your words over time. By generating a histogram of sentiment evolution, it helps uncover how feelings shift throughout a conversation—useful for scenarios like customer calls, where ending on a positive note can make all the difference.")
|
| 69 |
|
| 70 |
logo_path = "zega_logo.svg"
|
| 71 |
if os.path.exists(logo_path):
|
style.css
CHANGED
|
@@ -29,14 +29,17 @@ h4 {
|
|
| 29 |
|
| 30 |
/* Butoane */
|
| 31 |
|
| 32 |
-
button
|
|
|
|
| 33 |
font-weight: 600 !important;
|
| 34 |
}
|
| 35 |
-
button:hover
|
|
|
|
| 36 |
color: #FA6C03 !important;
|
| 37 |
border-color: #FA6C03 !important;
|
| 38 |
}
|
| 39 |
-
button:focus
|
|
|
|
| 40 |
color: #fff !important;
|
| 41 |
background-color: #FA6C03 !important;
|
| 42 |
}
|
|
@@ -57,7 +60,8 @@ button:focus {
|
|
| 57 |
}
|
| 58 |
|
| 59 |
/* Select */
|
| 60 |
-
.st-ae
|
|
|
|
| 61 |
font-family: inherit !important;
|
| 62 |
}
|
| 63 |
|
|
@@ -67,6 +71,6 @@ button:focus {
|
|
| 67 |
}
|
| 68 |
|
| 69 |
/* Other fonts */
|
| 70 |
-
|
| 71 |
-
|
| 72 |
}
|
|
|
|
| 29 |
|
| 30 |
/* Butoane */
|
| 31 |
|
| 32 |
+
button,
|
| 33 |
+
.myButton {
|
| 34 |
font-weight: 600 !important;
|
| 35 |
}
|
| 36 |
+
button:hover,
|
| 37 |
+
.myButton:hover {
|
| 38 |
color: #FA6C03 !important;
|
| 39 |
border-color: #FA6C03 !important;
|
| 40 |
}
|
| 41 |
+
button:focus,
|
| 42 |
+
.myButton:focus {
|
| 43 |
color: #fff !important;
|
| 44 |
background-color: #FA6C03 !important;
|
| 45 |
}
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
/* Select */
|
| 63 |
+
.st-ae,
|
| 64 |
+
.st-az {
|
| 65 |
font-family: inherit !important;
|
| 66 |
}
|
| 67 |
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
/* Other fonts */
|
| 74 |
+
[class^="st-emotion-cache-"] {
|
| 75 |
+
font-family: 'Inter Tight', Arial, Helvetica, sans-serif !important;
|
| 76 |
}
|