Create an Application That Creates Other Applications with ChatGPTšŸ¤Æ

bytehide

ByteHide

Posted on March 31, 2023

Create an Application That Creates Other Applications with ChatGPTšŸ¤Æ

Are you tired of spending many hours coding new applications from scratch? What if I told you that you can create new apps on your own?

It may sound too good to be true, but with the power of ChatGPT, you can do exactly that.

In this article, weā€™ll delve into the world of AI-based app development and show you how to create an app that creates other apps with ChatGPT.

Ready? Letā€™s go!

The App that creates other Apps

At the end I will leave the link to the GitHub repository so you can also use this application.

We have created an application that creates applications based on what we want using the ChatGPT API.

using OpenAI_API;
using Test;

OpenAIAPI api = new OpenAIAPI("YOUR_API_KEY"); // shorthand

var source = "";

await api.Completions.StreamCompletionAsync(
    new CompletionRequest("REQUEST_APPLICATION", Model.DavinciText, 200, 0.5, presencePenalty: 0.1, frequencyPenalty: 0.1),
    res => source += res.ToString());

//Console.WriteLine(source);

var compiler = new Compiler();
var runner = new Runner();

byte[] compiled = compiler.Compile(source);
string[] none = Array.Empty<string>();
runner.Execute(compiled, none);


Console.ReadLine();
Enter fullscreen mode Exit fullscreen mode

And for example we can try:

Create a C# code that asks me for a number with red text and check if it is odd or even. If it is even, it will have to return \"it is even\" in yellow. If it is odd, it will have to return by console \"is odd\" in blue. After answering me, you must ask me for another number in red and tell me if it is even or odd. Infinitely.

using OpenAI_API;
using Test;

OpenAIAPI api = new OpenAIAPI("YOUR_API_KEY"); // shorthand

var source = "";

await api.Completions.StreamCompletionAsync(
    new CompletionRequest("Create a C# code that asks me for a number with red text and check if it is odd or even. If it is even, it will have to return \"it is even\" in yellow. If it is odd, it will have to return by console \"is odd\" in blue. After answering me, you must ask me for another number in red and tell me if it is even or odd. Infinitely.", Model.DavinciText, 200, 0.5, presencePenalty: 0.1, frequencyPenalty: 0.1),
    res => source += res.ToString());

//Console.WriteLine(source);

var compiler = new Compiler();
var runner = new Runner();

byte[] compiled = compiler.Compile(source);
string[] none = Array.Empty<string>();
runner.Execute(compiled, none);


Console.ReadLine();
Enter fullscreen mode Exit fullscreen mode

If we run and try it:

a

It works well! Letā€™s try something different:

Create a C# application that asks me for 3 numbers one by one. Then return the average of those three numbers.

using OpenAI_API;
using Test;

OpenAIAPI api = new OpenAIAPI("YOUR_API_KEY"); // shorthand

var source = "";

await api.Completions.StreamCompletionAsync(
    new CompletionRequest("Create a C# application that asks me for 3 numbers one by one. Then return the average of those three numbers.", Model.DavinciText, 2000, 0.5, presencePenalty: 0.1, frequencyPenalty: 0.1),
    res => source += res.ToString());

//Console.WriteLine(source);

var compiler = new Compiler();
var runner = new Runner();

byte[] compiled = compiler.Compile(source);
string[] none = Array.Empty<string>();
runner.Execute(compiled, none);


Console.ReadLine();
Enter fullscreen mode Exit fullscreen mode

Letā€™s see the result:

Letā€™s try something more difficult.

Create a C# application that asks me for a path to indicate a csv file. The csv has 2 columns, the first one: ā€œusernameā€ and the second one ā€œloginsā€. In the first column are the names of the users. In the second column is the number of logins they have done. After inputting the path to the csv file, the application should output a table with the name and the number of logins of the 5 users who have made the most logins.

For this example we have prepared a simple example table with 100 names and random numbers which we have then exported in csv:

And done!

These are just a few simple ideas, but they can be as complicated as you want them to be. As I said at the beginning, here you have access to the repository on GitHub. If you manage to create something interesting, leave it in the comments section!

šŸ’– šŸ’Ŗ šŸ™… šŸš©
bytehide
ByteHide

Posted on March 31, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related