feat: new structure

This commit is contained in:
Florian Hönicke
2023-04-14 16:07:05 +02:00
parent e5a9336619
commit a65b5ff9df
22 changed files with 436 additions and 247 deletions

111
README.md
View File

@@ -1,8 +1,7 @@
<h1 align="center">
GPT Deploy: One line to create them all 🧙🚀
GPT Deploy: One line to generate them all 🧙🚀
</h1>
<p align="center">
<img src="res/gpt-deploy-logo.png" alt="Jina NOW logo" width="150px">
</p>
@@ -53,21 +52,35 @@ If you set the environment variable `OPENAI_API_KEY`, the configuration step can
Your api key must have access to gpt-4 to use this tool.
We are working on a way to use gpt-3.5-turbo as well.
### Create Microservice
### Generate Microservice
```bash
gptdeploy create --description "Given a PDF, return its text" --test "https://www.africau.edu/images/default/sample.pdf"
gptdeploy generate --description "<description of the microservice>" --test "<specification of a test scenario>" --path .
```
To create your personal microservice two things are required:
To generate your personal microservice two things are required:
- A `description` of the task you want to accomplish.
- A `test` scenario that ensures the microservice works as expected.
- A `path` on the local drive where the microservice will be generated.
The creation process should take between 5 and 15 minutes.
During this time, GPT iteratively builds your microservice until it finds a strategy that make your test scenario pass.
Once the microservice is created and deployed, you can test it using the generated Streamlit playground.
The deployment is made on the Jina`s infrastructure.
When creating a Jina account, you get some free credits, which you can use to deploy your microservice ($0.025/hour).
Be aware that the costs you have to pay for openai vary between $0.50 and $3.00 per microservice.
If you run out of credits, you can purchase more.
### Run Microservice
```bash
gptdeploy run --path <path to microservice>
```
### Deploy Microservice
It is required to have a [Jina account](https://cloud.jina.ai/) to deploy your microservice.
```bash
gptdeploy deploy --microservice_path <path to microservice>
```
[//]: # (Once the microservice is generated and deployed, you can test it using the generated Streamlit playground.)
[//]: # (The deployment is made on the Jina`s infrastructure. )
[//]: # (When creating a Jina account, you get some free credits, which you can use to deploy your microservice &#40;$0.025/hour&#41;.)
[//]: # (Be aware that the costs you have to pay for openai vary between $0.50 and $3.00 per microservice.)
[//]: # (If you run out of credits, you can purchase more.)
### Delete Microservice
To save credits you can delete your microservice via the following commands:
@@ -84,51 +97,51 @@ jc delete <microservice id>
### Animal Detector
```bash
gptdeploy create --description "Given an image, return the image with bounding boxes of all animals (https://pjreddie.com/media/files/yolov3.weights, https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3.cfg)" --test "https://images.unsplash.com/photo-1444212477490-ca407925329e contains animals"
gptdeploy generate --description "Given an image, return the image with bounding boxes of all animals (https://pjreddie.com/media/files/yolov3.weights, https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3.cfg)" --test "https://images.unsplash.com/photo-1444212477490-ca407925329e contains animals"
```
<img src="res/animal_detector_example.png" alt="Animal Detector" width="600" />
### Meme Generator
```bash
gptdeploy create --description "Generate a meme from an image and a caption" --test "Surprised Pikachu: https://media.wired.com/photos/5f87340d114b38fa1f8339f9/master/w_1600%2Cc_limit/Ideas_Surprised_Pikachu_HD.jpg, TOP:When you discovered GPTDeploy"
gptdeploy generate --description "Generate a meme from an image and a caption" --test "Surprised Pikachu: https://media.wired.com/photos/5f87340d114b38fa1f8339f9/master/w_1600%2Cc_limit/Ideas_Surprised_Pikachu_HD.jpg, TOP:When you discovered GPTDeploy"
```
<img src="res/meme_example.png" alt="Meme Generator" width="600" />
### Rhyme Generator
```bash
gptdeploy create --description "Given a word, return a list of rhyming words using the datamuse api" --test "hello"
gptdeploy generate --description "Given a word, return a list of rhyming words using the datamuse api" --test "hello"
```
<img src="res/rhyme_generator_example.png" alt="Rhyme Generator" width="600" />
### Word Cloud Generator
```bash
gptdeploy create --description "Generate a word cloud from a given text" --test "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
gptdeploy generate --description "Generate a word cloud from a given text" --test "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
```
<img src="res/word_cloud_example.png" alt="Word Cloud Generator" width="600" />
### 3d model info
```bash
gptdeploy create --description "Given a 3d object, return vertex count and face count" --test "https://raw.githubusercontent.com/polygonjs/polygonjs-assets/master/models/wolf.obj"
gptdeploy generate --description "Given a 3d object, return vertex count and face count" --test "https://raw.githubusercontent.com/polygonjs/polygonjs-assets/master/models/wolf.obj"
```
<img src="res/obj_info_example.png" alt="3D Model Info" width="600" />
### Table extraction
```bash
gptdeploy create --description "Given a URL, extract all tables as csv" --test "http://www.ins.tn/statistiques/90"
gptdeploy generate --description "Given a URL, extract all tables as csv" --test "http://www.ins.tn/statistiques/90"
```
<img src="res/table_extraction_example.png" alt="Table Extraction" width="600" />
### Audio to mel spectrogram
```bash
gptdeploy create --description "Create mel spectrograms from audio file" --test "https://cdn.pixabay.com/download/audio/2023/02/28/audio_550d815fa5.mp3"
gptdeploy generate --description "Create mel spectrograms from audio file" --test "https://cdn.pixabay.com/download/audio/2023/02/28/audio_550d815fa5.mp3"
```
<img src="res/audio_to_mel_example.png" alt="Audio to Mel Spectrogram" width="600" />
### Text to speech
```bash
gptdeploy create --description "Convert text to speech" --test "Hello, welcome to GPT Deploy!"
gptdeploy generate --description "Convert text to speech" --test "Hello, welcome to GPT Deploy!"
```
<a href=res/text_to_speech_example.wav><img src="res/text_to_speech_example.png" alt="Text to Speech" width="600" /></a>
@@ -139,20 +152,20 @@ gptdeploy create --description "Convert text to speech" --test "Hello, welcome t
### Heatmap Generator
```bash
gptdeploy create --description "Create a heatmap from an image and a list of relative coordinates" --test "https://images.unsplash.com/photo-1574786198875-49f5d09fe2d2, [[0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.2, 0.1], [0.7, 0.2], [0.4, 0.2]]"
gptdeploy generate --description "Create a heatmap from an image and a list of relative coordinates" --test "https://images.unsplash.com/photo-1574786198875-49f5d09fe2d2, [[0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.2, 0.1], [0.7, 0.2], [0.4, 0.2]]"
```
<img src="res/heatmap_example.png" alt="Heatmap Generator" width="600" />
### QR Code Generator
```bash
gptdeploy create --description "Generate QR code from URL" --test "https://www.example.com"
gptdeploy generate --description "Generate QR code from URL" --test "https://www.example.com"
```
<img src="res/qr_example.png" alt="QR Code Generator" width="600" />
### Mandelbrot Set Visualizer
```bash
gptdeploy create --description "Visualize the Mandelbrot set with custom parameters" --test "center=-0+1i, zoom=1.0, size=800x800, iterations=1000"
gptdeploy generate --description "Visualize the Mandelbrot set with custom parameters" --test "center=-0+1i, zoom=1.0, size=800x800, iterations=1000"
```
<img src="res/mandelbrot_example.png" alt="Mandelbrot Set Visualizer" width="600" />
@@ -164,7 +177,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Given a password, return a score from 1 to 10 indicating the strength of the password" --test "Pa$$w0rd => 1/5, !Akfdh%.ytRadf => 5/5")
[//]: # (gptdeploy generate --description "Given a password, return a score from 1 to 10 indicating the strength of the password" --test "Pa$$w0rd => 1/5, !Akfdh%.ytRadf => 5/5")
[//]: # (```)
@@ -172,7 +185,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Convert text to morse code" --test "Hello, welcome to GPT Deploy!")
[//]: # (gptdeploy generate --description "Convert text to morse code" --test "Hello, welcome to GPT Deploy!")
[//]: # (```)
@@ -180,7 +193,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Given an IP address, return the geolocation information" --test "142.251.46.174")
[//]: # (gptdeploy generate --description "Given an IP address, return the geolocation information" --test "142.251.46.174")
[//]: # (```)
@@ -188,7 +201,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Converts any currency into any other" --test "1 usd to eur")
[//]: # (gptdeploy generate --description "Converts any currency into any other" --test "1 usd to eur")
[//]: # (```)
@@ -196,7 +209,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Given an image, resize it to a specified width and height" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (gptdeploy generate --description "Given an image, resize it to a specified width and height" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (```)
@@ -204,7 +217,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Given a city, return the current weather" --test "Berlin")
[//]: # (gptdeploy generate --description "Given a city, return the current weather" --test "Berlin")
[//]: # (```)
@@ -213,7 +226,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Given a sudoku puzzle, return the solution" --test "[[2, 5, 0, 0, 3, 0, 9, 0, 1], [0, 1, 0, 0, 0, 4, 0, 0, 0], [4, 0, 7, 0, 0, 0, 2, 0, 8], [0, 0, 5, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 9, 8, 1, 0, 0], [0, 4, 0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 3, 6, 0, 0, 7, 2], [0, 7, 0, 0, 0, 0, 0, 0, 3], [9, 0, 3, 0, 0, 0, 6, 0, 4]]")
[//]: # (gptdeploy generate --description "Given a sudoku puzzle, return the solution" --test "[[2, 5, 0, 0, 3, 0, 9, 0, 1], [0, 1, 0, 0, 0, 4, 0, 0, 0], [4, 0, 7, 0, 0, 0, 2, 0, 8], [0, 0, 5, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 9, 8, 1, 0, 0], [0, 4, 0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 3, 6, 0, 0, 7, 2], [0, 7, 0, 0, 0, 0, 0, 0, 3], [9, 0, 3, 0, 0, 0, 6, 0, 4]]")
[//]: # (```)
@@ -222,7 +235,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Estimate a company's carbon footprint based on factors like transportation, electricity usage, waste production etc..." --test "Jina AI")
[//]: # (gptdeploy generate --description "Estimate a company's carbon footprint based on factors like transportation, electricity usage, waste production etc..." --test "Jina AI")
[//]: # (```)
@@ -231,7 +244,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Create a microservice that estimates the value of a property based on factors like location, property type, age, and square footage." --test "Berlin Friedrichshain, Flat, 100m², 10 years old")
[//]: # (gptdeploy generate --description "Create a microservice that estimates the value of a property based on factors like location, property type, age, and square footage." --test "Berlin Friedrichshain, Flat, 100m², 10 years old")
[//]: # (```)
@@ -240,7 +253,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Align two DNA or RNA sequences using the Needleman-Wunsch algorithm" --test "AGTC, GTCA")
[//]: # (gptdeploy generate --description "Align two DNA or RNA sequences using the Needleman-Wunsch algorithm" --test "AGTC, GTCA")
[//]: # (```)
@@ -249,7 +262,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Convert markdown to HTML" --test "# Hello, welcome to GPT Deploy!")
[//]: # (gptdeploy generate --description "Convert markdown to HTML" --test "# Hello, welcome to GPT Deploy!")
[//]: # (```)
@@ -258,7 +271,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Generate a barcode from a string" --test "Hello, welcome to GPT Deploy!")
[//]: # (gptdeploy generate --description "Generate a barcode from a string" --test "Hello, welcome to GPT Deploy!")
[//]: # (```)
@@ -267,7 +280,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Compress a file using the gzip algorithm" --test "content of the file: Hello, welcome to GPT Deploy!")
[//]: # (gptdeploy generate --description "Compress a file using the gzip algorithm" --test "content of the file: Hello, welcome to GPT Deploy!")
[//]: # (```)
@@ -276,7 +289,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Add a watermark &#40;GPT Deploy&#41; to an image" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (gptdeploy generate --description "Add a watermark &#40;GPT Deploy&#41; to an image" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (```)
@@ -285,7 +298,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Extract metadata from a file" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (gptdeploy generate --description "Extract metadata from a file" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (```)
@@ -294,7 +307,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Extract a thumbnail from a video" --test "http://techslides.com/demos/sample-videos/small.mp4")
[//]: # (gptdeploy generate --description "Extract a thumbnail from a video" --test "http://techslides.com/demos/sample-videos/small.mp4")
[//]: # (```)
@@ -303,7 +316,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Create a gif from a list of images" --test "https://images.unsplash.com/photo-1564725075388-cc8338732289, https://images.unsplash.com/photo-1584555684040-bad07f46a21f, https://images.unsplash.com/photo-1584555613497-9ecf9dd06f68")
[//]: # (gptdeploy generate --description "Create a gif from a list of images" --test "https://images.unsplash.com/photo-1564725075388-cc8338732289, https://images.unsplash.com/photo-1584555684040-bad07f46a21f, https://images.unsplash.com/photo-1584555613497-9ecf9dd06f68")
[//]: # (```)
@@ -316,7 +329,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # ()
[//]: # (```bash)
[//]: # (gptdeploy create --description "Visualize a sound file and output the visualization as video combined with the sound" --test "some/mp3/file.mp3")
[//]: # (gptdeploy generate --description "Visualize a sound file and output the visualization as video combined with the sound" --test "some/mp3/file.mp3")
[//]: # (```)
@@ -326,7 +339,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Convert a chemical formula into a 2D chemical structure diagram" --test "C6H6")
[//]: # (gptdeploy generate --description "Convert a chemical formula into a 2D chemical structure diagram" --test "C6H6")
[//]: # (```)
@@ -334,7 +347,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "creates aesthetically pleasing color palettes based on a seed color, using color theory principles like complementary or analogous colors" --test "red")
[//]: # (gptdeploy generate --description "creates aesthetically pleasing color palettes based on a seed color, using color theory principles like complementary or analogous colors" --test "red")
[//]: # (```)
@@ -343,7 +356,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Generate a depth map from a 3d Object" --test "https://raw.githubusercontent.com/polygonjs/polygonjs-assets/master/models/wolf.obj")
[//]: # (gptdeploy generate --description "Generate a depth map from a 3d Object" --test "https://raw.githubusercontent.com/polygonjs/polygonjs-assets/master/models/wolf.obj")
[//]: # (```)
@@ -355,7 +368,7 @@ gptdeploy create --description "Visualize the Mandelbrot set with custom paramet
[//]: # (```bash)
[//]: # (gptdeploy create --description "Convert image to ASCII art" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (gptdeploy generate --description "Convert image to ASCII art" --test "https://images.unsplash.com/photo-1602738328654-51ab2ae6c4ff")
[//]: # (```)
@@ -390,7 +403,7 @@ graph TB
registry --> deploy[deploy microservice]
deploy --> streamlit[create streamlit playground]
deploy --> streamlit[generate streamlit playground]
streamlit --> user_run[user tests microservice]
@@ -398,21 +411,21 @@ graph TB
1. GPT Deploy identifies several strategies to implement your task.
2. It tests each strategy until it finds one that works.
3. For each strategy, it creates the following files:
- executor.py: This is the main implementation of the microservice.
- test_executor.py: These are test cases to ensure the microservice works as expected.
3. For each strategy, it generates the following files:
- microservice.py: This is the main implementation of the microservice.
- test_microservice.py: These are test cases to ensure the microservice works as expected.
- requirements.txt: This file lists the packages needed by the microservice and its tests.
- Dockerfile: This file is used to run the microservice in a container and also runs the tests when building the image.
4. GPT Deploy attempts to build the image. If the build fails, it uses the error message to apply a fix and tries again to build the image.
5. Once it finds a successful strategy, it:
- Pushes the Docker image to the registry.
- Deploys the microservice.
- Creates a Streamlit playground where you can test the microservice.
- Generates a Streamlit playground where you can test the microservice.
6. If it fails 10 times in a row, it moves on to the next approach.
## 🔮 vision
Use natural language interface to create, deploy and update your microservice infrastructure.
Use natural language interface to generate, deploy and update your microservice infrastructure.
## ✨ Contributers
If you want to contribute to this project, feel free to open a PR or an issue.