Spaces:
Sleeping
Sleeping
Yash Chauhan
commited on
Commit
·
3b048f8
1
Parent(s):
5502fe0
[updated] code
Browse files
Dockerfile
CHANGED
|
@@ -8,6 +8,8 @@ RUN apt-get update && apt-get install -y \
|
|
| 8 |
python3-pip \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
|
|
|
|
|
|
| 11 |
ENV TRANSFORMERS_CACHE=/app/cache
|
| 12 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 13 |
|
|
|
|
| 8 |
python3-pip \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
RUN apt-get update && apt-get install -y ffmpeg
|
| 12 |
+
|
| 13 |
ENV TRANSFORMERS_CACHE=/app/cache
|
| 14 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 15 |
|
README.md
CHANGED
|
@@ -8,3 +8,12 @@ pinned: false
|
|
| 8 |
---
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
https://huggingface.co/spaces/codingyash/wshiper-api
|
| 14 |
+
|
| 15 |
+
curl -X 'POST' \
|
| 16 |
+
'https://codingyash-wshiper-api.hf.space/transcribe' \
|
| 17 |
+
-H 'accept: application/json' \
|
| 18 |
+
-H 'Content-Type: multipart/form-data' \
|
| 19 |
+
-F 'file=@test.wav'
|
app.py
CHANGED
|
@@ -8,7 +8,10 @@ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
|
| 8 |
|
| 9 |
os.environ["TRANSFORMERS_CACHE"] = "/app/cache"
|
| 10 |
|
| 11 |
-
app = FastAPI(
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Device configuration
|
| 14 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 8 |
|
| 9 |
os.environ["TRANSFORMERS_CACHE"] = "/app/cache"
|
| 10 |
|
| 11 |
+
app = FastAPI(
|
| 12 |
+
title = "Whisper API",
|
| 13 |
+
redirect_slashes=False
|
| 14 |
+
)
|
| 15 |
|
| 16 |
# Device configuration
|
| 17 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
test.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
url = "https://codingyash-wshiper-api.hf.space/transcribe/"
|
| 4 |
+
files = {"file": open("test.wav", "rb")}
|
| 5 |
+
response = requests.post(url, files=files)
|
| 6 |
+
print(response.json())
|