Spaces:
Running
on
Zero
Running
on
Zero
Control visibility of column based on env var
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from pathlib import Path
|
2 |
from typing import Tuple
|
3 |
import gradio as gr
|
@@ -7,6 +8,7 @@ from huggingface_hub import repo_exists
|
|
7 |
|
8 |
from speech_to_text_finetune.config import LANGUAGES_NAME_TO_ID
|
9 |
|
|
|
10 |
languages = LANGUAGES_NAME_TO_ID.keys()
|
11 |
model_ids = [
|
12 |
"",
|
@@ -88,7 +90,7 @@ def setup_gradio_demo():
|
|
88 |
gr.Markdown(
|
89 |
""" # 🗣️ Speech-to-Text Transcription
|
90 |
### 1. Select a language from the dropdown menu.
|
91 |
-
### 2. Select which model to load from one of the
|
92 |
### 3. Load the model by clicking the Load model button.
|
93 |
### 4. Record a message and click Transcribe to see the transcription.
|
94 |
"""
|
@@ -109,7 +111,7 @@ def setup_gradio_demo():
|
|
109 |
label="Option 2: Paste HF model id",
|
110 |
placeholder="my-username/my-whisper-tiny",
|
111 |
)
|
112 |
-
with gr.Column():
|
113 |
local_model = gr.Textbox(
|
114 |
label="Option 3: Paste local path to model directory",
|
115 |
placeholder="artifacts/my-whisper-tiny",
|
|
|
1 |
+
import os
|
2 |
from pathlib import Path
|
3 |
from typing import Tuple
|
4 |
import gradio as gr
|
|
|
8 |
|
9 |
from speech_to_text_finetune.config import LANGUAGES_NAME_TO_ID
|
10 |
|
11 |
+
is_hf_space = os.getenv("IS_HF_SPACE")
|
12 |
languages = LANGUAGES_NAME_TO_ID.keys()
|
13 |
model_ids = [
|
14 |
"",
|
|
|
90 |
gr.Markdown(
|
91 |
""" # 🗣️ Speech-to-Text Transcription
|
92 |
### 1. Select a language from the dropdown menu.
|
93 |
+
### 2. Select which model to load from one of the options below.
|
94 |
### 3. Load the model by clicking the Load model button.
|
95 |
### 4. Record a message and click Transcribe to see the transcription.
|
96 |
"""
|
|
|
111 |
label="Option 2: Paste HF model id",
|
112 |
placeholder="my-username/my-whisper-tiny",
|
113 |
)
|
114 |
+
with gr.Column(visible=not is_hf_space):
|
115 |
local_model = gr.Textbox(
|
116 |
label="Option 3: Paste local path to model directory",
|
117 |
placeholder="artifacts/my-whisper-tiny",
|