Spaces:
Sleeping
Sleeping
GVAmaresh
commited on
Commit
·
5163b6e
1
Parent(s):
72efdc6
dev: fixing ffmpeg error
Browse files- Dockerfile +1 -0
- app.py +4 -2
- requirements.txt +1 -0
Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ WORKDIR /app
|
|
| 8 |
|
| 9 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 10 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
| 11 |
|
| 12 |
COPY --chown=user . /app
|
| 13 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 8 |
|
| 9 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 10 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 11 |
+
RUN apt-get update && apt-get install -y ffmpeg
|
| 12 |
|
| 13 |
COPY --chown=user . /app
|
| 14 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
app.py
CHANGED
|
@@ -303,11 +303,13 @@ os.makedirs("/tmp/huggingface_cache", exist_ok=True)
|
|
| 303 |
SAVE_DIR = './audio'
|
| 304 |
os.makedirs(SAVE_DIR, exist_ok=True)
|
| 305 |
|
|
|
|
|
|
|
| 306 |
|
| 307 |
def reencode_audio(input_path, output_path):
|
| 308 |
command = [
|
| 309 |
-
|
| 310 |
-
|
| 311 |
subprocess.run(command, check=True)
|
| 312 |
|
| 313 |
#--------------------------------------------------------------------------------------------------------------------
|
|
|
|
| 303 |
SAVE_DIR = './audio'
|
| 304 |
os.makedirs(SAVE_DIR, exist_ok=True)
|
| 305 |
|
| 306 |
+
os.system('apt-get update && apt-get install -y ffmpeg')
|
| 307 |
+
|
| 308 |
|
| 309 |
def reencode_audio(input_path, output_path):
|
| 310 |
command = [
|
| 311 |
+
'/usr/bin/ffmpeg', '-i', input_path, '-acodec', 'pcm_s16le', '-ar', '16000', '-ac', '1', output_path
|
| 312 |
+
]
|
| 313 |
subprocess.run(command, check=True)
|
| 314 |
|
| 315 |
#--------------------------------------------------------------------------------------------------------------------
|
requirements.txt
CHANGED
|
@@ -22,3 +22,4 @@ gdown
|
|
| 22 |
PyPDF2
|
| 23 |
tf-keras
|
| 24 |
requests
|
|
|
|
|
|
| 22 |
PyPDF2
|
| 23 |
tf-keras
|
| 24 |
requests
|
| 25 |
+
ffmpeg-python
|