This is a sample text generation app using OpenAI's GPT-3 API. It's built with Blazor WebAssembly and hosted on Azure Static Web Apps.
-
Clone this repo
-
Create
appsettings.json
file in the root directory wwwroot with the following content:-
Location of the file: wwwroot/appsettings.json
-
Create a free account on OpenAI and get your API key from here
-
Content of the file:
{ "SecretKeys": { "APIKey": "sk-****************************" } }
-
-
Change the directory to Blazor-Azure-OpenAI and run
dotnet restore
to install the dependencies (only required for the first time)cd Blazor-Azure-OpenAI dotnet restore
-
Run the app with:
dotnet run
: for developmentdotnet run watch
: for development with hot reloaddotnet publish
: for production
-
Open the app in your browser at
http://localhost:[port]
- The port will be displayed in the terminal
- Find the
launchSettings.json
file in the Properties folder to change the port