Sakalti commited on
Commit
8c83344
·
verified ·
1 Parent(s): 99b4947

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -2,11 +2,17 @@ import gradio as gr
2
  import requests
3
  import torch
4
  from transformers import AutoModel, AutoConfig
5
- from huggingface_hub import HfApi
6
  import safetensors
7
  import os
8
 
9
  def convert_and_deploy(url, repo_id, hf_token):
 
 
 
 
 
 
10
  # セーフテンソルファイルをダウンロード
11
  response = requests.get(url)
12
  if response.status_code != 200:
 
2
  import requests
3
  import torch
4
  from transformers import AutoModel, AutoConfig
5
+ from huggingface_hub import HfApi, login
6
  import safetensors
7
  import os
8
 
9
  def convert_and_deploy(url, repo_id, hf_token):
10
+ # Hugging Face Hubにログイン
11
+ try:
12
+ login(token=hf_token)
13
+ except Exception as e:
14
+ return f"Hugging Face Hubへのログインに失敗しました。エラー: {e}"
15
+
16
  # セーフテンソルファイルをダウンロード
17
  response = requests.get(url)
18
  if response.status_code != 200: