This repository contains a Flask application for analyzing conversations uploaded by users. The application extracts text from uploaded audio files, performs sentiment analysis, and provides insights about the speakers involved in the conversation.
- Python 3.10 installed on your system
- Virtual environment (optional but recommended)
- Dependencies installed using
pip install -r requirements.txt
- Environment variables configured in a
.env
file
-
Clone the repository to your local machine:
git clone https://github.com/ridasaleem0/conversation_analysis_openAI.git
-
Navigate to the project directory:
cd conversation_analysis_openAI
-
(Optional) Set up a virtual environment:
# Create a virtual environment python3.10 -m venv venv # Activate the virtual environment # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up your environment variables in a
.env
file. Include any necessary API keys or configuration settings.
Make sure to configure the following environment variables in your .env
file. For this assignment, we have provided both keys for testing the flask app.
OPENAI_API_KEY
: Your OpenAI API key for performing speaker analysis using the GPT model.DEEPGRAM_API_KEY
= Your DeepGram API key to transcribe the audio files to text.
Run the Flask application using the following command:
python app.py
The application will start, and you can access it in your web browser at http://localhost:2005
.
Users can upload conversation files through the web interface. Supported file formats include text and audio.
After uploading a conversation, the application performs sentiment analysis and speaker insights. Users can view the analysis results on the web interface.
If you encounter any issues while running the application, try the following troubleshooting steps:
- Check Dependencies: Make sure all dependencies are installed correctly by running pip install -r requirements.txt again.
- API Keys: Verify that any API keys (such as OpenAI API key) are valid and have the necessary permissions.
- File Permissions: Ensure that the Flask application has permission to read and write files in the specified directories, especially for uploaded files.
- Logging: Check the application logs for any error messages or exceptions that might provide clues about the issue.
- Environment Variables: Double-check the .env file to ensure that all required environment variables are correctly configured.
- Network Connectivity: If the application relies on external services (such as Deepgram for audio transcription), ensure that your network connection is stable and not blocked by firewalls. If the issue persists, feel free to open an issue in the GitHub repository for further assistance.
app.py
: Main Flask application file containing routes and logic for handling uploads and analysis.speaker_analysis_gpt.py
: Python module for performing speaker analysis and psychological insights using OpenAI's GPT model.transcribe_audio_deepgram.py
: Python module for extracting text from audio files using Deepgram's transcription service.