Cant process files!
Opened this issue · 3 comments
{"detail":"Unsupported file type: application/octet-stream"} is the output of curl, tested both doc and docx files, where can put my hands on?
Ok the problem was in curl where the file was passed as octet-stream, so i had to force the mimetype based on the file type, so i tried:
curl --location 'http://0.0.0.0:8000/translate-file-download' --form 'api_type="open_ai"' --form 'translate_type="de_es"' --form 'file=@"/var/www/html/translator/input/Trittsteine1.docx";type=application/vnd.openxmlformats-officedocument.wordprocessingml.document'
with a successful response, but as a txt file. Not bad.
We need to fix the prompt because even i changed the languages (keeping the prompt intact) the document where translated to english in the first part, and then to spanish.
+1 above solution worked!
I got another issue
{"detail":"str('latin-1' codec can't encode characters in position 0-3: ordinal not in range(256))"}
I thought this error might be a decode error, but I checked the code, decoder has already used "utf-8"...
the curl:
curl --location "http://localhost:8000/translate-file-download" --form "api_type=open_ai" --form "translate_type=en_zh" --form "file=@C:\Users\paul6\Downloads\test.pptx;type=application/vnd.openxmlformats-officedocument.presentationml.presentation"
curl --location "http://localhost:8000/translate-file-download" --form "api_type=open_ai" --form "translate_type=en_zh" --form "file=@C:\Users\paul6\Downloads\test.pdf;type=application/pdf"