locaal-ai / obs-polyglot

Realtime local AI translation services for OBS based on CTranslate2
https://obsproject.com/forum/resources/polyglot-real-time-local-translation-ai-service-for-obs.1818/
GNU General Public License v2.0
64 stars 6 forks source link

Error 404 (CORS header ‘Access-Control-Allow-Origin’ missing) when calling /translate #10

Open jojo58fr opened 8 months ago

jojo58fr commented 8 months ago

Hello !

I want to build a streamelements widget that use OBS-Polyglot. I have test my request through insomnia, it get me a 200 OK with the translation but when i use this code on a widget streamelements, i've got a CORS Error.

Would it be possible to correct this issue ? Thank you very much for all your hard work on Polyglot.

const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"text":"Bonjour monde.","source_lang":"fr_Latn","target_lang":"eng_Latn"}'
};

fetch('http://127.0.0.1:18080/translate', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

image

On the streamelements widget: image