This project is for learning and practicing APIs integration and Flask. See sources linked below.
We are building Flask web applications with a user interfaces:
- An AI-powered chatbot with ChatGPT
gpt-3.5-turbo
model - A Python YouTube video Downloader
- And more to come ...
- Basic cloud computing knowledge
- SSH into a server
- Basic scripting
- Languages: Python, HTML, CSS, Flask
- CI/CD: Jenkins
- Source Control: Git, GitHub
- CSP: AWS
- Apllications Architechtures
- CI/CD Pipeline
This is the workflow of the pipeline.
-
Create a folder and
cd
into it and set up the file architecture. -
Create the virtual environment:
python3 -m venv virtual_environment_name
- Activate the virtial environment
source virtual_environment_name/bin/activate
Note: Use a .gitignore
file to avoid inporting the virtual environment folder (and/or other unwanted files) to GitHub.
Use deactivate
to deactivate the virtual environment.
- Install Requirements:
- Set up virtual environment.
- Install the requirements using
pip
.
pip install --upgrade
pip install flask
pip install pytest
pip install openai
pip install pytube3
pip install youtube_transcript_api
- You can also add the
requirements.txt
file in your project folder and install from it by using the command below.
pip install -r requirements.txt
Here is how to get the requirements.txt
file.
- Local Environment Variables (in Linux Ubuntu WSL)
- Get your OpenAI API key. Make sure you do not overwrite your
.bashrc
file.
echo "export OPENAI_API_KEY='key_value'" >> ~/.bashrc source ~/.bashrc
- Get your OpenAI API key. Make sure you do not overwrite your
- (Online) Environment Variables
- Run the command
python3 flask-app-file.py
or simplyflask run
.
- Now, you can go to the
localhost
or127.0.0.1/5000
to see the home page. The port number maybe different - double check!
- Click on 1st button and enter your request to the ChatGPT API.
- You can also test the YouTube Transcribe
- Go on YouTube and get a valid URL
- Paste the URL in the form - you can get to the form by clicking the button
YouTube Transcribe
.
Make sure you clean up your system, the YouTube Transcribe app will download .mp4
files like it shows below. You can also ignore the files in .gitignore
file:
- Set up test files to test your code. You can use a simple status code check with pytest.
- Set up Jenkins server and integrate it to GitHub using a webhook.
- You can also set up email notification in case the pipeline fails.
- Follow this link to set up a docker/dockerhub account.
- Choose NGINX or Apache for Frontend
- Set up deploy stage - push docker image to AWS using this AWS ECR - Medium doc or AWS ECR - OCTOPUS.
- For Practice, push docker image to DockerHub.
- Install pip
- Python script source
- Set up Environment Variable for API Key
- HTML/CSS
- YouTube Transcript Generator
- codegpt | blog.devgenius | Youtube | AIAdvantage
- Fask app testing-1 | testing-2 | testing-3 | Jenkins-Pytest | Github-Action Pytest
- iamnearlythere.com
- EC2 ami locator
- Dockerfile Linter