Spaces:
Runtime error
Runtime error
Download sentiment_analysis.py from VladB46/VerbalSentimentAnalysis: direct link, hf CLI and curl.
- Browser
- Download file 658 Bytes
-
https://huggingface.co/spaces/VladB46/VerbalSentimentAnalysis/resolve/main/sentiment_analysis.py
- Command line
-
hf download hf://spaces/VladB46/VerbalSentimentAnalysis/sentiment_analysis.py
-
curl -L -o sentiment_analysis.py https://huggingface.co/spaces/VladB46/VerbalSentimentAnalysis/resolve/main/sentiment_analysis.py
658 Bytes
| from translation import get_transcription_from_sound | |
| from gemini_call import ask_gemini | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| def get_analysis(file_path)->str: | |
| """Makes the pipeline to perform the sentiment analysis on a .wav file""" | |
| transcript = get_transcription_from_sound(file_path) | |
| if len(transcript) > 0: | |
| analysis = ask_gemini(transcript) | |
| else : | |
| analysis = "Did not provide any message in order to be analysed" | |
| return transcript , analysis | |
| if __name__ == "__main__": | |
| file_path = "recorded_audio.wav" | |
| transcript , analysis = get_analysis(file_path) | |
| print(f'Analysis result {analysis}') |