Team Ai
Apppublic

natasa365/whisper.cpp

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
bench.js29 linesDownload Raw Back to server
1import http from 'k6/http'2import { check } from 'k6'3 4export let options = {5  vus: parseInt(__ENV.CONCURRENCY) || 4,6  iterations: parseInt(__ENV.CONCURRENCY) || 4,7}8 9const filePath        = __ENV.FILE_PATH10const baseURL         = __ENV.BASE_URL        || 'http://127.0.0.1:8080'11const endpoint        = __ENV.ENDPOINT        || '/inference'12const temperature     = __ENV.TEMPERATURE     || '0.0'13const temperatureInc  = __ENV.TEMPERATURE_INC || '0.2'14const responseFormat  = __ENV.RESPONSE_FORMAT || 'json'15 16// Read the file ONCE at init time17const fileBin = open(filePath, 'b')18 19export default function () {20  const payload = {21    file:           http.file(fileBin, filePath),22    temperature:    temperature,23    temperature_inc: temperatureInc,24    response_format: responseFormat,25  }26 27  const res = http.post(`${baseURL}${endpoint}`, payload)28  check(res, { 'status is 200': r => r.status === 200 })29}