ianeksdi commited on
Commit
72e07db
·
verified ·
1 Parent(s): 092529b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1,10 +1,9 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import requests
4
- from googletrans import Translator
5
 
6
  client = InferenceClient("mistralai/Mistral-Nemo-Instruct-2407")
7
- translator = Translator()
8
 
9
  def get_internet_data(query: str) -> str:
10
  """
@@ -31,12 +30,11 @@ def get_internet_data(query: str) -> str:
31
 
32
  def translate_to_bisaya(text: str) -> str:
33
  """
34
- Translates the given text to Bisaya (Cebuano) using googletrans.
35
  """
36
  try:
37
  # 'ceb' is the ISO 639-3 code for Cebuano
38
- translation = translator.translate(text, dest='ceb')
39
- return translation.text
40
  except Exception:
41
  return text
42
 
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import requests
4
+ from deep_translator import GoogleTranslator
5
 
6
  client = InferenceClient("mistralai/Mistral-Nemo-Instruct-2407")
 
7
 
8
  def get_internet_data(query: str) -> str:
9
  """
 
30
 
31
  def translate_to_bisaya(text: str) -> str:
32
  """
33
+ Translates the given text to Bisaya (Cebuano) using deep-translator.
34
  """
35
  try:
36
  # 'ceb' is the ISO 639-3 code for Cebuano
37
+ return GoogleTranslator(source='auto', target='ceb').translate(text)
 
38
  except Exception:
39
  return text
40