gpsxpc commited on
Commit
c19f6f3
·
verified ·
1 Parent(s): a05452f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -6,10 +6,10 @@ IDIOMAS = {
6
  "English": "en-GB",
7
  "Portuguese (Brazil)": "pt-BR",
8
  "Portuguese (Portugal)": "pt-PT",
9
- "Spanish": "es",
10
  "French": "fr-FR",
11
- "German": "de",
12
- "Italian": "it"
13
  }
14
 
15
  def traduzir_arquivo(file, dest_language):
@@ -26,10 +26,10 @@ def traduzir_arquivo(file, dest_language):
26
  """
27
  try:
28
  # Detectar tipo de objeto
29
- if hasattr(file, "read"):
30
- text = file.read().decode("utf-8") # file-like object
31
- else:
32
- text = str(file) # já é string (NamedString do Hugging Face)
33
 
34
  # Dividir em blocos de até 5000 caracteres
35
  chunk_size = 5000
 
6
  "English": "en-GB",
7
  "Portuguese (Brazil)": "pt-BR",
8
  "Portuguese (Portugal)": "pt-PT",
9
+ "Spanish": "es-ES",
10
  "French": "fr-FR",
11
+ "German": "de-DE",
12
+ "Italian": "it-IT"
13
  }
14
 
15
  def traduzir_arquivo(file, dest_language):
 
26
  """
27
  try:
28
  # Detectar tipo de objeto
29
+ if hasattr(file, "read"): # file-like object
30
+ text = file.read().decode("utf-8")
31
+ else: # NamedString do Hugging Face
32
+ text = str(file)
33
 
34
  # Dividir em blocos de até 5000 caracteres
35
  chunk_size = 5000