Skip to content

⭐Gradio for .NET – a port of Gradio, an open-source Python package that allows you to quickly build a demo or web application for your machine learning model, API, or any arbitrary Python function. Gradio for .NET – 基于 Gradio 的 .NET 移植,Gradio 是一个开源 Python 包,允许你为机器学习模型、API 或任何任意 Python 函数快速构建演示或 Web 应用程序。

License

Notifications You must be signed in to change notification settings

iebcn309/Gradio.Net

 
 

Repository files navigation

Gradio.NET: Build Machine Learning Web Apps — in .NET main NuGet

English | 简体中文

Gradio for .NET – a port of Gradio, an open-source Python package that allows you to quickly build a demo or web application for your machine learning model, API, or any arbitrary Python function. No JavaScript, CSS, or web hosting experience needed!

demo

It just takes a few lines of .NET code to create a beautiful demo like the one above, so let's get started 💫

Building Your First Demo

    1. Create a ASP.NET Core Web API project.
    1. Install NuGet package Gradio.Net.AspNetCore.
    1. Enter the sample code in Program.cs:
App.Launch(await CreateBlocks());

async Task<Blocks> CreateBlocks()
{
    using (var blocks = gr.Blocks())
    {
        gr.Markdown("Start typing below and then click **Run** to see the output.");
        Textbox input, output;
        using (gr.Row())
        {
            input = gr.Textbox(placeholder: "What is your name?");
            output = gr.Textbox();
        }
        var btn = gr.Button("Run");
        await btn.Click(fn: async (input) => gr.Output($"Welcome to Gradio.Net, {Textbox.Payload(input.Data[0])}!"), inputs: new[] { input }, outputs: new[] { output });

        return blocks;
    }
}

That's All🎉🎉🎉

If you wan to use Gradio.Net.AspNetCore in exists project

You can use AddGradio and UseGradio extension methods:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGradio();

var app = builder.Build();

app.UseGradio(await CreateBlocks());

app.Run();

Demos

Source Code Demo Image
Layout image
Form image
Media image
Chatbot image
Progress image

About

⭐Gradio for .NET – a port of Gradio, an open-source Python package that allows you to quickly build a demo or web application for your machine learning model, API, or any arbitrary Python function. Gradio for .NET – 基于 Gradio 的 .NET 移植,Gradio 是一个开源 Python 包,允许你为机器学习模型、API 或任何任意 Python 函数快速构建演示或 Web 应用程序。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 54.5%
  • JavaScript 38.3%
  • CSS 5.7%
  • HTML 1.5%