dayannex commited on
Commit
d71688b
·
1 Parent(s): a021dd0

app modified

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -159,11 +159,7 @@ class Model:
159
  def fake_city(self):
160
  return self.faker_.city()
161
  def reemplazo_fake(self,identificadores):
162
-
163
- if self.idioma=='es':
164
- self.faker_ = Faker('es_MX')
165
- else:
166
- self.faker_ = Faker('en_US')
167
 
168
 
169
  new_iden=[]
@@ -322,6 +318,12 @@ class ModeloDataset:
322
  def fake_city(self):
323
  return self.faker_.city()
324
  def reemplazo_fake(self,identificadores):
 
 
 
 
 
 
325
  new_iden=[]
326
  for id in identificadores:
327
 
@@ -548,10 +550,11 @@ def procesar(texto,archivo, etiquetas):
548
  for item in df.columns.values:
549
  sentences=df[item]
550
  model.identificacion_idioma(sentences[0])
551
-
552
  ides, predicted = modelo.aplicar_modelo(sentences,model.idioma,etiquetas)
553
 
554
  if model.idioma=="es":
 
555
  out=modelo.salida_texto2_es( ides,predicted)
556
  print('out:',out)
557
  df_new[item] = modelo.unir_array(out)
 
159
  def fake_city(self):
160
  return self.faker_.city()
161
  def reemplazo_fake(self,identificadores):
162
+
 
 
 
 
163
 
164
 
165
  new_iden=[]
 
318
  def fake_city(self):
319
  return self.faker_.city()
320
  def reemplazo_fake(self,identificadores):
321
+
322
+ if self.idioma=='es':
323
+ self.faker_ = Faker('es_MX')
324
+ self.model = RobertaForTokenClassification.from_pretrained(self.modelo_ner)
325
+ else:
326
+ self.faker_ = Faker('en_US')
327
  new_iden=[]
328
  for id in identificadores:
329
 
 
550
  for item in df.columns.values:
551
  sentences=df[item]
552
  model.identificacion_idioma(sentences[0])
553
+ modelo.idioma=model.idioma
554
  ides, predicted = modelo.aplicar_modelo(sentences,model.idioma,etiquetas)
555
 
556
  if model.idioma=="es":
557
+
558
  out=modelo.salida_texto2_es( ides,predicted)
559
  print('out:',out)
560
  df_new[item] = modelo.unir_array(out)