Yash Chauhan commited on
Commit
3b048f8
·
1 Parent(s): 5502fe0

[updated] code

Browse files
Files changed (4) hide show
  1. Dockerfile +2 -0
  2. README.md +9 -0
  3. app.py +4 -1
  4. test.py +6 -0
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
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())