hyperaudio / hyperaudio-lite-editor

A lightweight transcript editor for editing and correcting STT generated timed transcripts
GNU Affero General Public License v3.0
35 stars 10 forks source link

Integrate replicate.com WhisperX #224

Open maboa opened 4 months ago

maboa commented 4 months ago
// Define the API token and endpoint
const replicateAPIToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'; // You should secure this token properly in production
const url = 'https://api.replicate.com/v1/predictions';

// Define the data payload for the POST request
const data = {
  version: "4a60104c44dd709fc08a03dfeca6c6906257633dd03fd58663ec896a4eeba30e",
  input: {
    audio: "https://replicate.delivery/pbxt/IfYtYMI5B23lFkUoI7zDtehuLw2NzKCoJpmJQvSVGD5l3gfY/vocals.mp3",
    model: "large-v1",
    initial_prompt: "Karstadtdetektiv",
    suppress_tokens: -1,
    word_timestamps: true,
    logprob_threshold: -1,
    append_punctuations: "\"'.。,,!!??::”)]}、",
    no_speech_threshold: 0.6,
    prepend_punctuations: "'“¿([{-",
    condition_on_previous_text: true,
    compression_ratio_threshold: 2,
    temperature_increment_on_fallback: 0.2
  }
};

// Use fetch API to send the POST request
fetch(url, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${replicateAPIToken}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log('Success:', data))
.catch((error) => console.error('Error:', error));
thebigboss9018 commented 1 month ago

Hello! firstly, great project! secondly, anyway we could use our local machine whisper instead of relaying in an api?

Thanks