Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import torch
|
| 2 |
|
| 3 |
import gradio as gr
|
|
@@ -5,15 +6,30 @@ import yt_dlp as youtube_dl
|
|
| 5 |
import numpy as np
|
| 6 |
from datasets import Dataset, Audio
|
| 7 |
from scipy.io import wavfile
|
|
|
|
| 8 |
|
| 9 |
from transformers import pipeline
|
| 10 |
from transformers.pipelines.audio_utils import ffmpeg_read
|
| 11 |
|
| 12 |
-
import tempfile
|
| 13 |
-
import os
|
| 14 |
import time
|
| 15 |
import demucs.api
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
MODEL_NAME = "openai/whisper-large-v3"
|
| 18 |
DEMUCS_MODEL_NAME = "htdemucs_ft"
|
| 19 |
BATCH_SIZE = 8
|
|
|
|
| 1 |
+
import os
|
| 2 |
import torch
|
| 3 |
|
| 4 |
import gradio as gr
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
from datasets import Dataset, Audio
|
| 8 |
from scipy.io import wavfile
|
| 9 |
+
from huggingface_hub import whoami
|
| 10 |
|
| 11 |
from transformers import pipeline
|
| 12 |
from transformers.pipelines.audio_utils import ffmpeg_read
|
| 13 |
|
|
|
|
|
|
|
| 14 |
import time
|
| 15 |
import demucs.api
|
| 16 |
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def hello(profile: gr.OAuthProfile | None) -> str:
|
| 21 |
+
if profile is None:
|
| 22 |
+
return "I don't know you."
|
| 23 |
+
return f"Hello {profile.name}"
|
| 24 |
+
|
| 25 |
+
def list_organizations(oauth_token: gr.OAuthToken | None) -> str:
|
| 26 |
+
if oauth_token is None:
|
| 27 |
+
return "Please log in to list organizations."
|
| 28 |
+
org_names = [org["name"] for org in whoami(oauth_token.token)["orgs"]]
|
| 29 |
+
return f"You belong to {', '.join(org_names)}."
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
MODEL_NAME = "openai/whisper-large-v3"
|
| 34 |
DEMUCS_MODEL_NAME = "htdemucs_ft"
|
| 35 |
BATCH_SIZE = 8
|