Skip to content

oilneck/openai-api-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openai-api-tutorial

A. Build/Run

To set up the environment variable for the OpenAI API key in a .env file, you should add the following line to the file:

OPENAI_API_KEY=sk-xxxxxxx

Replace sk-xxxxxxx with your actual API key.

Execute the following bash command:

./tutorial.sh build
./tutorial.sh start

B. Quick start

0. import modules

import funcs

1. chat

result = funcs.chat('hello!')
print(result)

2. image2text

result = funcs.image2text('./data/image01.jpg', prompt='What’s in this image?')
print(result)

3. text2image

funcs.text2image('a putty cat', filename='cat.jpg')

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published