Code Monkey home page Code Monkey logo

chatgpt-images-r-shiny's Introduction

analytics-in-motion-chatgpt-images-r-shiny

ChatGPT Images - R Shiny

R   Shiny   DALL·E   MIT license   Lifecycle:Maturing   R-CMD-check   test-coverage   OpenAI   Analytics in Motion  


R Shiny Application/Package to create and manage images using ChatGPT.

1. Description

This application provides a simple web interface using Shiny to dynamically create images using OpenAI's ChatGPT models.

chatgpt-image-creation-using-r-shiny.mp4

2. Getting Started

2.1 Dependencies

  • Requires an OpenAI API Key (create an account and get API Key at https://chat.openai.com)
  • Requires the following packages:
    • shiny (>= 1.7.4)
    • golem (>= 0.3.5)
    • shinydashboard (>= 0.7.2)
    • openai (>= 0.3.0)
    • config (>= 0.3.1)
    • testthat (>= 3.0.0)

Please be aware of the costs associated with using the OpenAI API when utilizing this project.

2.2 Launching the Project

Step 1 - Download the repository

Step 2 - Open the project file chatgptimages.Rproj in RStudio

Step 3 - Open the run_dev.R file in the dev directory (see Section 5 - Directory Structure if you are unable to locate)

Step 4 - Run the run_dev.R file

Your default browser should open with the application

3. Instructions

The application has 4 basic screens to navigate - Instructions, Create Image, Image Gallery, and Settings.



3.1 Instructions Page

The instructions page is the default page that is shown when the application is run. It provides a complte run down of how to use the application.



3.2 Settings: - Enter API Key

In order to use this application a user must have an API Key from OpenAI. This can be done by creating an account from the following link: https://chat.openai.com. Once a user has got their API Key it can be added into the app and saved.


Please Note: Depending on how this application is deployed, the API Keys will be kept in persistant storage. That means they will persist until overwritten, even after shutting down the app. If you are deploying this in a production environment please read the Best practices for API packages.

3.3 Create Image

In the text box, type a description of the image you want ChatGPT to create. The generator can create images in 3 different sizes:

  • 256x256
  • 512x512
  • 1024x1024.

This can be selected in the dropdown box. Then click the Create Image button. In 2-3 seconds the image will appear.



3.4 Image Gallery

All images that a user creates will be stored in the gallery.



4. Top 10 Image Creation Ideas

If you are stuck for inspiration try one of these creation prompts:

1. Oil painting mountains and water
2. watercolor landscape
3. Pointillism trees
4. Futuristic cars
5. Mona Lisa laughing
6. An astronaut riding a horse in a photorealistic style
7. Fantasy artwork
8. Family Christmas photo
9. Painting of a kangaroo cartoon style
10. A funny image that makes me laugh



5. Directory Structure

This project follows the golem/R Packages architecture.

chatgptimages
├── DESCRIPTION
├── NAMESPACE
├── LICENSE
├── LICENSE.md
├── chatgptimages.Rproj
├── .Renviron
├── R
│   ├── app_config.R
│   ├── app_server.R
│   ├── app_ui.R
│   ├── fct_get_filename.R
│   ├── fct_get_images.R  
│   ├── fct_get_url.R
│   ├── fct_set_apikey.R
│   ├── golem_utils_server.R
│   ├── golem_utils_ui.R
│   ├── mod_create_image.R
│   ├── mod_input_apikey.R
│   ├── mod_show_gallery.R
│   ├── mod_show_instructions.R
│   └── run_app.R
├── tests
│   ├── testthat
│   │   ├── test-golem_utils_server.R
│   │   ├── test-golem_utils_ui.R
│   │   ├── test-golem-recommended.R
│   │   ├── test-mod_create_image.R
│   │   ├── test-mod_input_apikey.R
│   │   ├── test-mod_show_gallery.R
│   │   └── test-mod_show_instructions
│   ├── spelling.R
│   ├── app_configtestthat.R
├── dev
│   ├── 01_start.R
│   ├── 02_dev.R
│   ├── 03_deploy.R
│   └── run_dev.R
├── inst
│   ├── app
│   │   └── www
│   │       └── favicon.ico
│   ├── golem-config.yml
│   └── WORDLIST
└── man
    └── run_app.Rd

6. Best Practices for API Key Safety

Your OpenAI APIKEY key/s should be kept secure and private at all times.

Please follow the best practices guide for API security from OpenAI
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety

chatgpt-images-r-shiny's People

Contributors

rossarmstrong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.