File size: 1,670 Bytes
2873292
af346ba
2873292
 
 
 
 
 
af346ba
2873292
 
af346ba
30dce5a
af346ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: FastapiSample
emoji: 📝
colorFrom: yellow
colorTo: yellow
sdk: docker
app_file: app.py
pinned: false
license: mit
---

# FastAPI アプリケーションの Hugging Face へのデプロイ

このリポジトリは、FastAPI アプリケーションを Hugging Face にデプロイする方法を示すチュートリアルです。

アプリケーションは [https://tregu0458-fastapisample.hf.space](https://tregu0458-fastapisample.hf.space) で利用可能です。
[apiのマニュアル](https://tregu0458-fastapisample.hf.space/docs)
## エンドポイント

### ホーム

- URL: `/`
- メソッド: GET
- レスポンス: `{'detail': 'Welcome to FastAPI Tutorial!'}`

### hello

- URL: `/`
- メソッド: POST
- パラメータ:
  - `name` (str): 名前
- レスポンス: `{'message': 'hello {name}!'}`

## Hugging Face へのデプロイ

1. Hugging Face のアカウントを作成し、ログインします。
2. 新しいモデルリポジトリを作成します。
3. このリポジトリをクローンし、`main.py` ファイルをアップロードします。
4. Hugging Face のモデルページで、"Deploy" タブを開き、"Spaces" を選択します。
5. "Create New Space" をクリックし、Space の名前を入力して、"Create" をクリックします。
6. "Deploy" ボタンをクリックし、デプロイが完了するまで待ちます。

デプロイが完了すると、Hugging Face の Space URL でアプリケーションにアクセスできます。

## 参考資料

- [Hugging Face Spaces のドキュメント](https://huggingface.co/blog/HemanthSai7/deploy-applications-on-huggingface-spaces)