Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Sample apps utilizing AI as a Service (primarily OpenAI ) Web APIs

License

Notifications You must be signed in to change notification settings

MGTheTrain/python-sample-apps-with-AIaaS-apis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-sample-apps-with-AIaaS-apis

Table of Contents

Summary

Sample apps utilizing AI as a Service (primarily OpenAI) Web APIs.

Reference

Features

  • Chat bot sample app utilizing gpt-3.5-turbo or gpt-4-turbo model
  • Image generator sample app utilizing dall-e-2 or dall-e-3 model
  • Speech generator sample app utilizing tts-1 or tts-1-hd model

Getting started

Preconditions

Starting applications


Chat bot

Install pip dependencies:

cd samples/chat-bot
pip install -r requirements.txt

If user content does not consist of multiple new lines, run:

python chat_bot.py --system <System content here. Can be set to ''> --user <User content here> --model <gpt-3.5-turbo, gpt-4-turbo>

# User content with multiple new lines -> Update the content in the [user-content.txt file](samples/chat-bot/assets/user-content.txt) and run
python chat_bot.py --system <System content here. Can be set to ''> --model <gpt-3.5-turbo, gpt-4-turbo>

Update the content in the user-content.txt file if user content consists of multiple new lines, run:

python chat_bot.py --system <System content here. Can be set to ''> --model <gpt-3.5-turbo, gpt-4-turbo>

NOTE: You might need to change your billing plan, if you encounter the error openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}


Image generator

Install pip dependencies and run application:

cd samples/image-generator
pip install -r requirements.txt
python image_generator.py --model <dall-e-2, dall-e-3> --prompt "<user content>" --size <size of the image to be generated, e.g. 1024x1024>
# Checkout link of `Generated image URL` in a browser of choice

NOTE: "When using DALL·E 3, images can have a size of 1024x1024, 1024x1792 or 1792x1024 pixels."


Speech generator

cd samples/speech-generator
pip install -r requirements.txt
python speech_generator.py --model tts-1-hd --voice alloy --input "Hello, how are you today?" --output output/hello.mp3

About

Sample apps utilizing AI as a Service (primarily OpenAI ) Web APIs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published