diff --git a/README.md b/README.md index b68f540..16b890d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Gradio.NET: Build Machine Learning Web Apps — in .NET [![main](https://github.com/feiyun0112/Gradio.Net/actions/workflows/main.yml/badge.svg)](https://github.com/feiyun0112/Gradio.Net/actions/workflows/main.yml) [![NuGet](https://img.shields.io/nuget/v/Gradio.Net.svg)](https://nuget.org/packages/Gradio.Net) -**English** | **[简体中文](readme_files/README_zh-cn.md)** +**English** | **[简体中文](readme_files/README_zh-cn.md)** | **[日本語](readme_files/README_ja.md)** Gradio for .NET – a port of [Gradio](https://github.com/gradio-app/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!* diff --git a/readme_files/README_ja.md b/readme_files/README_ja.md new file mode 100644 index 0000000..ba0a829 --- /dev/null +++ b/readme_files/README_ja.md @@ -0,0 +1,67 @@ +# Gradio.NET: .NETで機械学習Webアプリを構築 [![main](https://github.com/feiyun0112/Gradio.Net/actions/workflows/main.yml/badge.svg)](https://github.com/feiyun0112/Gradio.Net/actions/workflows/main.yml) [![NuGet](https://img.shields.io/nuget/v/Gradio.Net.svg)](https://nuget.org/packages/Gradio.Net) + +**[English](../README.md)** | **[简体中文](readme_files/README_zh-cn.md)** | **日本語** + +Gradio for .NET – [Gradio](https://github.com/gradio-app/gradio) の .NET 移植版で、機械学習モデル、API、または任意のPython関数のデモやWebアプリケーションを迅速に**構築**するためのオープンソースのPythonパッケージです。*JavaScript、CSS、またはWebホスティングの経験は不要です!* + +![demo](./demo.gif) + +上記のような美しいデモを作成するには、ほんの数行の .NET コードが必要です。それでは始めましょう 💫 + +### 最初のデモを構築する + +- 1. ASP.NET Core Web API プロジェクトを作成します。 + +- 2. NuGet パッケージ **Gradio.Net.AspNetCore** をインストールします。 + +- 3. Program.cs にサンプルコードを入力します: + + +```C# +App.Launch(await CreateBlocks()); + +async Task 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; + } +} +``` + +これで完了です🎉🎉🎉 + +**既存のプロジェクトで **Gradio.Net.AspNetCore** を使用したい場合** + +`AddGradio` と `UseGradio` 拡張メソッドを使用できます: + +```C# +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddGradio(); + +var app = builder.Build(); + +app.UseGradio(await CreateBlocks()); + +app.Run(); +``` + +### デモ + +| Source Code | Demo Image | +| ----------- | ---------- | +| [Layout](./layout_demo.md) | ![image](./layout_demo.gif) | +| [Form](./form_demo.md) | ![image](./form_demo.gif) | +| [Media](./media_demo.md) | ![image](./media_demo.gif) | +| [Chatbot](./chatbot_demo.md) | ![image](./chatbot_demo.gif) | +| [Progress](./progress_demo.md) | ![image](./progress_demo.gif) | diff --git a/readme_files/README_zh-cn.md b/readme_files/README_zh-cn.md index c8da97a..5f9ae90 100644 --- a/readme_files/README_zh-cn.md +++ b/readme_files/README_zh-cn.md @@ -1,6 +1,6 @@ # Gradio.NET: 使用 .NET 生成机器学习 Web 应用 [![main](https://github.com/feiyun0112/Gradio.Net/actions/workflows/main.yml/badge.svg)](https://github.com/feiyun0112/Gradio.Net/actions/workflows/main.yml) [![NuGet](https://img.shields.io/nuget/v/Gradio.Net.svg)](https://nuget.org/packages/Gradio.Net) -**[English](../README.md)** | 简体中文 +**[English](../README.md)** | **[简体中文](readme_files/README_zh-cn.md)** | **[日本語](readme_files/README_ja.md)** Gradio for .NET – [Gradio](https://github.com/gradio-app/gradio) 的 .NET 移植,Gradio是一个开源 Python 包,允许您为机器学习模型、API 或任何任意 Python 函数快速构建演示或 Web 应用程序。*无需任何 JavaScript、CSS 经验!*