5

Create an Application That Creates Other Applications with ChatGPT🤯

 1 year ago
source link: https://dev.to/bytehide/create-an-application-that-creates-other-applications-with-chatgpt-d83
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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();

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();

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();

Let’s see the result:

a2a0032cf1773e82fc5a9bd7b86bc568.gif

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:

image-37-298x440.png

And done!

image-36.png

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!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK