Commit ·
3bd5d2b
1
Parent(s): df00910
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import base64
|
|
|
|
| 2 |
from functools import partial
|
| 3 |
from multiprocessing import Pool
|
| 4 |
|
|
@@ -14,7 +15,8 @@ title = "Whisper JAX: The Fastest Whisper API ⚡️"
|
|
| 14 |
|
| 15 |
description = "Whisper JAX is an optimised implementation of the [Whisper model](https://huggingface.co/openai/whisper-large-v2) by OpenAI. It runs on JAX with a TPU v4-8 in the backend. Compared to PyTorch on an A100 GPU, it is over **12x** faster, making it the fastest Whisper API available."
|
| 16 |
|
| 17 |
-
API_URL =
|
|
|
|
| 18 |
|
| 19 |
article = "Whisper large-v2 model by OpenAI. Backend running JAX on a TPU v4-8 through the generous support of the [TRC](https://sites.research.google/trc/about/) programme. Whisper JAX code and Gradio demo by 🤗 Hugging Face."
|
| 20 |
|
|
@@ -52,7 +54,7 @@ def inference(inputs, language=None, task=None, return_timestamps=False):
|
|
| 52 |
|
| 53 |
|
| 54 |
def chunked_query(payload):
|
| 55 |
-
response = requests.post(
|
| 56 |
return response.json()
|
| 57 |
|
| 58 |
|
|
|
|
| 1 |
import base64
|
| 2 |
+
import os
|
| 3 |
from functools import partial
|
| 4 |
from multiprocessing import Pool
|
| 5 |
|
|
|
|
| 15 |
|
| 16 |
description = "Whisper JAX is an optimised implementation of the [Whisper model](https://huggingface.co/openai/whisper-large-v2) by OpenAI. It runs on JAX with a TPU v4-8 in the backend. Compared to PyTorch on an A100 GPU, it is over **12x** faster, making it the fastest Whisper API available."
|
| 17 |
|
| 18 |
+
API_URL = os.getenv("API_URL")
|
| 19 |
+
API_URL_FROM_FEATURES = os.getenv("API_URL_FROM_FEATURES")
|
| 20 |
|
| 21 |
article = "Whisper large-v2 model by OpenAI. Backend running JAX on a TPU v4-8 through the generous support of the [TRC](https://sites.research.google/trc/about/) programme. Whisper JAX code and Gradio demo by 🤗 Hugging Face."
|
| 22 |
|
|
|
|
| 54 |
|
| 55 |
|
| 56 |
def chunked_query(payload):
|
| 57 |
+
response = requests.post(API_URL_FROM_FEATURES, json=payload)
|
| 58 |
return response.json()
|
| 59 |
|
| 60 |
|