Skip to content

mattgotteiner/AI-Chat-App-Hack-Vision

Repository files navigation

AI-Chat-App-Hack-Vision

Tutorial on how to combine GPT-4 and Vision

This project uses the sample nature data set from Vision Studio.

Credits

Much of this content is possible because of the azure-search-openai-demo, please check it out!

Azure account requirements

IMPORTANT: In order to deploy and run this example, you'll need:

In order to run the notebooks in this example repository, you'll need:

  • Azure subscription with access enabled for the Azure OpenAI service. You can request access with this form. If your access request to Azure OpenAI service doesn't match the acceptance criteria, you can use OpenAI public API instead.

Azure deployment

Cost estimation

Pricing varies per region and usage, so it isn't possible to predict exact costs for your usage. However, you can try the Azure pricing calculator for the resources below.

  • Azure App Service: Basic Tier with 1 CPU core, 1.75 GB RAM. Pricing per hour. Pricing
  • Azure OpenAI: Standard tier, ChatGPT models. Pricing per 1K tokens used, and at least 1K tokens are used per question. Pricing
  • Azure AI Search: Standard tier, 1 replica. Pricing per hour. Pricing
  • Azure Blob Storage: Standard tier with ZRS (Zone-redundant storage). Pricing per storage and read operations. Pricing
  • Azure Monitor: Pay-as-you-go tier. Costs based on data ingested. Pricing

To reduce costs, you can switch to free SKUs for various services, but those SKUs have limitations. See this guide on deploying with minimal costs for more details.

⚠️ To avoid unnecessary costs, remember to take down your app if it's no longer in use, either by deleting the resource group in the Portal or running azd down.

Project setup

Local environment

First install the required tools:

  • Azure Developer CLI
  • Python 3.9, 3.10, or 3.11
    • Important: Python and the pip package manager must be in the path in Windows for the setup scripts to work.
    • Important: Ensure you can run python --version from console. On Ubuntu, you might need to run sudo apt install python-is-python3 to link python to python3.
  • Node.js 14+
  • Git
  • Powershell 7+ (pwsh) - For Windows users only.
    • Important: Ensure you can run pwsh.exe from a PowerShell terminal. If this fails, you likely need to upgrade PowerShell.

Then bring down the project code:

  1. Create a new folder and switch to it in the terminal
  2. Run azd auth login
  3. Run azd init -t https://github.com/mattgotteiner/AI-Chat-App-Hack-Vision
    • note that this command will initialize a git repository and you do not need to clone this repository

Deploying from scratch

Execute the following command, if you don't have any pre-existing Azure services and want to start from a fresh deployment.

  1. Run azd up - This will provision Azure resources and deploy this sample to those resources, including building the search index based on the files found in the ./data folder.
    • Important: Beware that the resources created by this command will incur immediate costs, primarily from the AI Search resource. These resources may accrue costs even if you interrupt the command before it is fully executed. You can run azd down or delete the resources manually to avoid unnecessary spending.
  2. After the application has been successfully deployed you will see a URL printed to the console. Click that URL to interact with the application in your browser.

NOTE: It may take 5-10 minutes for the application to be fully deployed. If you see a "Python Developer" welcome screen or an error page, then wait a bit and refresh the page.

Running locally

You can only run locally after having successfully run the azd up command. If you haven't yet, follow the steps in Azure deployment above.

  1. Run azd auth login
  2. Change dir to app and run ./start.ps1
  3. Or use VS Code "Run & Debug"
  4. Open a browser and navigate to http://localhost:50505

Clean up

To clean up all the resources created by this sample:

  1. Run azd down
  2. When asked if you are sure you want to continue, enter y
  3. When asked if you want to permanently delete the resources, enter y

The resource group and all the resources will be deleted.

About

Tutorial on how to combine GPT-4 and Vision

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published