Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://huggingface.co/spaces/artglobal/minicpm-fastapi
Browse files- app.py +9 -0
- requirements.txt +3 -1
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from fastapi import FastAPI, File, UploadFile, Form, HTTPException
|
2 |
from typing import List
|
3 |
from pydantic import BaseModel
|
@@ -5,6 +7,13 @@ from PIL import Image
|
|
5 |
import io
|
6 |
from transformers import AutoModel, AutoTokenizer
|
7 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
from fastapi import FastAPI, File, UploadFile, Form, HTTPException
|
4 |
from typing import List
|
5 |
from pydantic import BaseModel
|
|
|
7 |
import io
|
8 |
from transformers import AutoModel, AutoTokenizer
|
9 |
import torch
|
10 |
+
from huggingface_hub import login
|
11 |
+
from dotenv import load_dotenv
|
12 |
+
load_dotenv()
|
13 |
+
|
14 |
+
api_key = os.getenv("HF_TOKEN")
|
15 |
+
|
16 |
+
login(token = api_key)
|
17 |
|
18 |
app = FastAPI()
|
19 |
|
requirements.txt
CHANGED
@@ -6,4 +6,6 @@ torchvision==0.16.2
|
|
6 |
transformers==4.40.0
|
7 |
sentencepiece==0.1.99
|
8 |
decord
|
9 |
-
python-multipart
|
|
|
|
|
|
6 |
transformers==4.40.0
|
7 |
sentencepiece==0.1.99
|
8 |
decord
|
9 |
+
python-multipart
|
10 |
+
huggingface_hub
|
11 |
+
python-dotenv
|