Spaces:
Running
Running
Ar4ikov
commited on
Commit
·
2be93d1
1
Parent(s):
08c9a0c
Refactor Gradio app launch and update dependencies
Browse files- Replaced direct demo launch with a new _launch_app function to handle server configuration and queuing.
- Updated Gradio version from 4.44.0 to 6.0.0 in README.md and requirements.txt.
- Removed unused API name parameter in the Gradio interface setup.
- README.md +2 -2
- __pycache__/app.cpython-312.pyc +0 -0
- app.py +16 -2
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🔥
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
@@ -26,7 +26,7 @@ The end-to-end variants (`e2e_*`) produce punctuated, normalized text, while the
|
|
| 26 |
- Python 3.10
|
| 27 |
- PyTorch / torchaudio 2.8.0
|
| 28 |
- `transformers==4.57.1`
|
| 29 |
-
- `gradio==
|
| 30 |
- Optional: set `HF_TOKEN` (or `HUGGINGFACEHUB_API_TOKEN`) if you want to use the segmented mode or access private weights.
|
| 31 |
|
| 32 |
## Running locally
|
|
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.0.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
| 26 |
- Python 3.10
|
| 27 |
- PyTorch / torchaudio 2.8.0
|
| 28 |
- `transformers==4.57.1`
|
| 29 |
+
- `gradio==6.0.0` (see `requirements.txt` for the full list)
|
| 30 |
- Optional: set `HF_TOKEN` (or `HUGGINGFACEHUB_API_TOKEN`) if you want to use the segmented mode or access private weights.
|
| 31 |
|
| 32 |
## Running locally
|
__pycache__/app.cpython-312.pyc
ADDED
|
Binary file (12.1 kB). View file
|
|
|
app.py
CHANGED
|
@@ -241,7 +241,6 @@ def build_interface() -> gr.Blocks:
|
|
| 241 |
fn=transcribe_audio,
|
| 242 |
inputs=[audio_input, variant_dropdown, mode_radio],
|
| 243 |
outputs=[transcript_output, segments_output, metadata_output],
|
| 244 |
-
api_name="transcribe",
|
| 245 |
)
|
| 246 |
|
| 247 |
return demo
|
|
@@ -249,6 +248,21 @@ def build_interface() -> gr.Blocks:
|
|
| 249 |
|
| 250 |
demo = build_interface()
|
| 251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
if __name__ == "__main__":
|
| 253 |
-
|
| 254 |
|
|
|
|
| 241 |
fn=transcribe_audio,
|
| 242 |
inputs=[audio_input, variant_dropdown, mode_radio],
|
| 243 |
outputs=[transcript_output, segments_output, metadata_output],
|
|
|
|
| 244 |
)
|
| 245 |
|
| 246 |
return demo
|
|
|
|
| 248 |
|
| 249 |
demo = build_interface()
|
| 250 |
|
| 251 |
+
|
| 252 |
+
def _launch_app() -> None:
|
| 253 |
+
"""Launch the Gradio app with sensible defaults for HF Spaces and local runs."""
|
| 254 |
+
is_space = bool(os.getenv("SPACE_ID"))
|
| 255 |
+
launch_kwargs = {
|
| 256 |
+
"server_name": os.getenv("GRADIO_SERVER_NAME", "0.0.0.0" if is_space else "127.0.0.1"),
|
| 257 |
+
"server_port": int(os.getenv("GRADIO_SERVER_PORT", "7860")),
|
| 258 |
+
"show_api": False,
|
| 259 |
+
"share": False,
|
| 260 |
+
}
|
| 261 |
+
enable_queue = os.getenv("ENABLE_GRADIO_QUEUE", "1") != "0"
|
| 262 |
+
app = demo.queue(max_size=8) if enable_queue else demo
|
| 263 |
+
app.launch(**launch_kwargs)
|
| 264 |
+
|
| 265 |
+
|
| 266 |
if __name__ == "__main__":
|
| 267 |
+
_launch_app()
|
| 268 |
|
requirements.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
torch==2.8.0
|
| 2 |
torchaudio==2.8.0
|
| 3 |
transformers==4.57.1
|
| 4 |
-
gradio==
|
| 5 |
soundfile>=0.12.1
|
| 6 |
numpy>=1.26.4
|
| 7 |
hydra-core>=1.3.2
|
|
|
|
| 1 |
torch==2.8.0
|
| 2 |
torchaudio==2.8.0
|
| 3 |
transformers==4.57.1
|
| 4 |
+
gradio==6.0.0
|
| 5 |
soundfile>=0.12.1
|
| 6 |
numpy>=1.26.4
|
| 7 |
hydra-core>=1.3.2
|