React Native mobile app that shows a list of random jokes from jokes API and then with openAI API generates image based on the joke of your choice
Instruction to deploy this project:
- run:
git clone https://github.com/akatsay/random-joke-and-AI-image-generator.git
npm i
- you'll need to install expo-cli:
npm install expo-cli --global
go to https://platform.openai.com/account/api-keys and reserve your API key
/*
you can create folder secret and file secret.ts
and then import it like this:
*/
// src/secret/secret.ts demo:
const API: string = // Pass your open AI API key
export default API
//
import API from '../secret/secret';
const fetchImage = useCallback( async () => {
const configuration = new Configuration({
apiKey: API, // or you can simply pass API key here
})
...
/*
IMPORTANT NOTICE, it's better to handle this logic
on the server and keep API keys in env variables but since it's just a demo not intended for production I decided to omit it.
*/
You can either install SDKs from: https://expo.dev/tools
Or install expoGo app on your device
then run:
npx expo start
and either scan the code in the console with expoGo app on your device or use SDKs