hiddenFront commited on
Commit
b303ca3
·
verified ·
1 Parent(s): 44d2bcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -6
app.py CHANGED
@@ -9,18 +9,13 @@ import sys
9
  import collections
10
  import logging # 로깅 모듈 임포트
11
 
12
- # transformers의 AutoTokenizer 및 BertModel 임포트
13
  from transformers import AutoTokenizer, BertModel
14
  from torch.utils.data import Dataset, DataLoader
15
  from huggingface_hub import hf_hub_download
16
 
17
- # --- 로깅 설정 ---
18
- # INFO 레벨 이상의 로그를 출력하도록 설정합니다.
19
- # 실제 배포 환경에서는 로그 레벨을 WARNING이나 ERROR로 높여 불필요한 로그를 줄일 수 있습니다.
20
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
21
  logger = logging.getLogger(__name__)
22
 
23
- # --- 1. BERTClassifier 모델 클래스 정의 ---
24
  class BERTClassifier(torch.nn.Module):
25
  def __init__(self,
26
  bert,
@@ -68,7 +63,6 @@ class BERTDataset(Dataset):
68
  def __len__(self):
69
  return len(self.labels)
70
 
71
- # --- 3. FastAPI 앱 및 전역 변수 설정 ---
72
  app = FastAPI()
73
  device = torch.device("cpu") # Hugging Face Spaces의 무료 티어는 주로 CPU를 사용합니다.
74
 
 
9
  import collections
10
  import logging # 로깅 모듈 임포트
11
 
 
12
  from transformers import AutoTokenizer, BertModel
13
  from torch.utils.data import Dataset, DataLoader
14
  from huggingface_hub import hf_hub_download
15
 
 
 
 
16
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
17
  logger = logging.getLogger(__name__)
18
 
 
19
  class BERTClassifier(torch.nn.Module):
20
  def __init__(self,
21
  bert,
 
63
  def __len__(self):
64
  return len(self.labels)
65
 
 
66
  app = FastAPI()
67
  device = torch.device("cpu") # Hugging Face Spaces의 무료 티어는 주로 CPU를 사용합니다.
68