Add bi_v100-sensevoice and bi_v100-whisper as subdirectories
This commit is contained in:
BIN
bi_v100-whisper/.DS_Store
vendored
Normal file
BIN
bi_v100-whisper/.DS_Store
vendored
Normal file
Binary file not shown.
10
bi_v100-whisper/Dockerfile_whisper
Normal file
10
bi_v100-whisper/Dockerfile_whisper
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM zibo.harbor.iluvatar.com.cn:30000/saas/bi100-3.2.1-x86-ubuntu20.04-py3.10-poc-llm-infer:v1.2.2
|
||||
|
||||
RUN mkdir /workspace
|
||||
WORKDIR /workspace/
|
||||
|
||||
COPY asr_server_whisper.py /workspace/asr_server_whisper.py
|
||||
COPY ./launch_service /workspace/launch_service
|
||||
COPY whisper-tiny /model
|
||||
|
||||
ENTRYPOINT ["./launch_service"]
|
||||
34
bi_v100-whisper/asr_server_whisper.py
Normal file
34
bi_v100-whisper/asr_server_whisper.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import torch
|
||||
from transformers import pipeline
|
||||
from flask import Flask, request, jsonify
|
||||
from threading import Lock
|
||||
|
||||
asr_pipeline = pipeline(
|
||||
task="automatic-speech-recognition",
|
||||
model="/model",
|
||||
torch_dtype=torch.float16,
|
||||
device="cuda:0"
|
||||
)
|
||||
|
||||
app = Flask(__name__)
|
||||
pipeline_lock = Lock()
|
||||
|
||||
@app.route('/recognition', methods=['POST'])
|
||||
def predict():
|
||||
audio_data = request.data
|
||||
params = request.params
|
||||
params_json = json.loads(params)
|
||||
lang = params_json.get('language', 'en')
|
||||
with pipeline_lock:
|
||||
res = asr_pipeline(inputs=audio_data, generate_kwargs={"language": lang})
|
||||
text = res['text'].strip()
|
||||
return jsonify({'RecognitionStatus': 'Success', "DisplayText": text})
|
||||
|
||||
@app.route('/ready', methods=['GET'])
|
||||
@app.route('/health', methods=['GET'])
|
||||
@app.route('/health_check', methods=['GET'])
|
||||
def health():
|
||||
return jsonify({'status': 'ok'})
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=80)
|
||||
9
bi_v100-whisper/launch_service
Executable file
9
bi_v100-whisper/launch_service
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
data
|
||||
cat /proc/cpuinfo
|
||||
ixsmi
|
||||
export
|
||||
date
|
||||
|
||||
python3 asr.py
|
||||
BIN
bi_v100-whisper/whisper-tiny/.msc
Normal file
BIN
bi_v100-whisper/whisper-tiny/.msc
Normal file
Binary file not shown.
1
bi_v100-whisper/whisper-tiny/.mv
Normal file
1
bi_v100-whisper/whisper-tiny/.mv
Normal file
@@ -0,0 +1 @@
|
||||
Revision:master,CreatedAt:1736300537
|
||||
Reference in New Issue
Block a user