occ-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
46 stars 5 forks source link

error parsing json #2

Closed ther3y3s closed 8 months ago

ther3y3s commented 8 months ago

Hi, i have this error something when i try to use this plugin.

I use cloud closed captions to get captions and save them in a text source. Those are my settings:

image

image

That's polygon settings:

image

And those are url source settings: image

This is the body. I didn't find it on the page so i write it from youtube: {"text":"{{input}}", "source_lang":"eng_Latn","target_lang":"ita_Latn"}

image

To test if this works or not i enable the preview on captions and start to talk. You can ses on top captions text, on bottom the translation: image

royshil commented 8 months ago

@ther3y3s thanks for the feedback i think first step let's try the Test Request button

Screenshot 2023-10-29 at 10 10 53 AM

And look for the Request Body section to see the JSON request is well formatted

image
ther3y3s commented 8 months ago

image

But i notice after i stop to speak i have always the same output messagge: image

andi i created another time the url source

ther3y3s commented 8 months ago

ok so i notice when i stop to talk and so captions disappears, the polyglot gets this output messagge (di cui si tratta) Instead of returning a blank value

royshil commented 8 months ago

@ther3y3s yeah I think the model when it gets an empty text it has this "default value". It's common with LLMs to do this.

I think maybe if after {{input}} you put a "." it would be better

But the actual solution would be to never call polyglot in the first place, just clear the output... That's something I can work on.

ther3y3s commented 8 months ago

If i put a . there {"text":"{{input}}"." i get "error parsing json"

royshil commented 8 months ago

Try {"text":"{{input}}.", ...}

ther3y3s commented 8 months ago

always the "default value". So i think it's better just to disable the captions timeout.

But idk why i have always that problem image

royshil commented 8 months ago

This is peculiar since the JSON generally looks ok, maybe the newlines are a problem and need to be serialized to \ns but that's not available in obs-urlsource right now. I can work on that though.

royshil commented 8 months ago

I fixed this on URL Source. The new version will fix this

ther3y3s commented 8 months ago

I fixed this on URL Source. The new version will fix this

Oh wow thanks! Is alredy avaible or i can test it? Because i will use polyglot tomorrow

royshil commented 8 months ago

@ther3y3s you can grab this version https://github.com/occ-ai/obs-urlsource/actions/runs/6758096048#artifacts which will have this feature implemented remember to add "Content-Type" -> "application/json" as a request header

royshil commented 8 months ago

this is now implemented in the latest release of obs-urlsource