atsushieee commited on
Commit
71dda67
·
1 Parent(s): da7452f

Upload folder using huggingface_hub

Browse files
crepe/assets/.DS_Store ADDED
Binary file (6.15 kB). View file
 
main.py CHANGED
@@ -1,4 +1,37 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  def click_test():
4
  """1から10までのランダムな数値を生成する関数"""
@@ -8,20 +41,34 @@ def click_test():
8
 
9
  # Gradio インターフェースの作成
10
  with gr.Blocks() as demo:
11
- gr.Markdown("# ランダム数値ジェネレーター")
12
- gr.Markdown("下のボタンをクリックすると1から10までのランダムな数値が生成されます。")
13
 
14
  # 結果表示用のテキストボックス
15
- output_text = gr.Text(label="結果")
 
16
 
17
- # カスタムボタンの追加
18
- generate_btn = gr.Button(
19
- value="数値を生成する", # ボタンのテキスト
20
- variant="primary", # ボタンのスタイル
21
- size="lg" # ボタンのサイズ
22
- )
 
 
 
 
 
 
 
 
23
 
24
  # ボタンクリック時のイベント設定
 
 
 
 
 
25
  generate_btn.click(
26
  fn=click_test,
27
  outputs=output_text
 
1
  import gradio as gr
2
+ import os
3
+ import requests
4
+ from tqdm import tqdm
5
+
6
+ def check_and_download_model():
7
+ temp_dir = "/tmp"
8
+ model_path = os.path.join(temp_dir, "large-v2.pt")
9
+
10
+ if os.path.exists(model_path):
11
+ return f"モデルは既に存在します: {model_path}"
12
+
13
+ url = "https://openaipublic.azureedge.net/main/whisper/models/81f7c96c852ee8fc832187b0132e569d6c3065a3252ed18e56effd0b6a73e524/large-v2.pt"
14
+
15
+ try:
16
+ response = requests.get(url, stream=True)
17
+ response.raise_for_status()
18
+ total_size = int(response.headers.get('content-length', 0))
19
+
20
+ with open(model_path, 'wb') as f, tqdm(
21
+ desc=model_path,
22
+ total=total_size,
23
+ unit='iB',
24
+ unit_scale=True,
25
+ unit_divisor=1024,
26
+ ) as pbar:
27
+ for data in response.iter_content(chunk_size=1024):
28
+ size = f.write(data)
29
+ pbar.update(size)
30
+
31
+ return f"モデルのダウンロードが完了しました: {model_path}"
32
+
33
+ except Exception as e:
34
+ return f"エラーが発生しました: {e}"
35
 
36
  def click_test():
37
  """1から10までのランダムな数値を生成する関数"""
 
41
 
42
  # Gradio インターフェースの作成
43
  with gr.Blocks() as demo:
44
+ gr.Markdown("# Whisper モデルチェッカー & ランダム数値ジェネレーター")
45
+ gr.Markdown("下のボタンでモデルの確認・ダウンロードと、ランダム数値の生成ができます。")
46
 
47
  # 結果表示用のテキストボックス
48
+ model_status = gr.Text(label="モデルの状態")
49
+ output_text = gr.Text(label="ランダム数値の結果")
50
 
51
+ with gr.Row():
52
+ # モデルチェック用ボタン
53
+ check_btn = gr.Button(
54
+ value="モデルを確認する",
55
+ variant="secondary",
56
+ size="lg"
57
+ )
58
+
59
+ # ランダム数値生成用ボタン
60
+ generate_btn = gr.Button(
61
+ value="数値を生成する",
62
+ variant="primary",
63
+ size="lg"
64
+ )
65
 
66
  # ボタンクリック時のイベント設定
67
+ check_btn.click(
68
+ fn=check_and_download_model,
69
+ outputs=model_status
70
+ )
71
+
72
  generate_btn.click(
73
  fn=click_test,
74
  outputs=output_text
speaker_pretrain/best_model.pth.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b67178273ee7ea1cdea4378a3ec9a6e0da93d75238ad641ddb4714e4ef46ea14
3
+ size 114064632