I think your best option is looking for an alternative to googletrans. Note that you can send http requests to a translation api, you don’t need a dedicated python library for that.
Guna Sekha, try the following, Best regards . -Alejandro Samid
To address the compatibility issue between googletrans and recent versions of openai, you can switch to an alternative translation library. Here’s a step-by-step guide to update your project:
Remove googletrans from your requirements.txt file.
Choose an alternative translation library. Based on the search results, deep-translator is a good option as it’s actively maintained and offers multiple translation services.
Update your requirements.txt file to include the new library:
streamlit
openai
deep-translator
Update your code to use the new library. Here’s an example using deep-translator with Google Translate:
Install the new library in your development environment:
pip install deep-translator
Test your updated code to ensure it works as expected.
Commit the changes to your GitHub repository.
Re-deploy your Streamlit app to apply the changes.
Using deep-translator offers several advantages:
It supports multiple translation services, including Google Translate, Microsoft Translator, and others.
It can be used directly from the terminal.
It supports batch translations.
It allows translations from text files.
However, note that language detection with deep-translator requires a private API key.
By following these steps, you should resolve the compatibility issue between googletrans and openai while maintaining the translation functionality in your Streamlit app.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.