jamesahnking / trasaterra-gpt-flask-template

Trasaterra GPT Chatbot Flask application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trasaterra GPT Local Flask Dev Environment Setup :

Get Started:

  1. Clone repo
  2. cd into the directory
  3. Start a virtual environment: python venv venv
  4. Activate virtual environment: source venv/bin/activate(Mac)
  5. Choose the venv. interpreter for the command pallet in VS Code it is often the 'recommended' choice
  6. Install app dependencies with pip:
    • pip install flask
    • pip install functions
    • pip install openai
    • pip install packaging
    • pip install requests
    • pip install prompt
  7. Install ngrok:brew install ngrok/ngrok/ngrok
  8. Add Auth token: ngrok config add-authtoken 2ZYQoVIDN45sf4YgkOfEcZx7QvZ_2WmKfJFKDNsXAhhZHmSj
  9. Run application: python -m flask --app ./main.py run
  10. Spin up ngrok to expose endpoints: While applciation is running open new bash terminal and type the following ngrok http 5000

Commands:

Turn On Environment:

source venv/bin/activate

Upgrade pip:

python -m pip install --upgrade pip

Install Deps:

pip install depname

Verify Install:

pip list

Deactivate venv:

deactivate

Run application:

python -m flask --app ./main.py run

Run Ngrok

ngrok http http://localhost:5000


App dependency list:

  • python = ">=3.10.0,3.11"
  • flask = "^3.0.0"
  • functions = "^0.7.0"
  • openai = "^1.2.3"
  • packaging = "^23.2"
  • requests = "2.31.0"
  • prompt = "^0.4.1"

PIP Install

  • pip install flask
  • pip install functions
  • pip install openai
  • pip install packaging
  • pip install requests
  • pip install prompt

Useful Resources:

Expose Local web server to internet with flask app: https://sumanshunankana.hashnode.dev/expose-a-local-web-server-to-the-internet-example-flask-app

How to create a simple flask app in just 5 minutes: https://youtu.be/6M3LzGmIAso?si=ndAo_d_NFOwbkFig

Python Boilerplate for .gitignore: https://www.python-boilerplate.com/about/

Ingrok: Ingress Platfor for Devs: Expose endpoints for VF (2FA required) https://ngrok.com/

Start applciation over from scratch commit: commit 27b9d995f30bd6a98d150bf0f39bc762fb04a315


Ngrok Info:

Install Ngrok

brew install ngrok/ngrok/ngrok

Run Auth Token:

ngrok config add-authtoken 2ZYQoVIDN45sf4YgkOfEcZx7QvZ_2WmKfJFKDNsXAhhZHmSjs

Response:

Authtoken saved to configuration file: /Users/jamesahnking/Library/Application Support/ngrok/ngrok.yml

About

Trasaterra GPT Chatbot Flask application


Languages

Language:Python 100.0%