pfialho commited on
Commit
6488dec
·
verified ·
1 Parent(s): a5b1554

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -62,7 +62,6 @@ app_examples = [
62
  ]
63
 
64
 
65
-
66
  def remove_emojis(data):
67
  if '@' in data:
68
  data = re.sub(r"(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z0-9-_]+[A-Za-z0-9-_]+)", "", data).strip()
@@ -96,6 +95,11 @@ def remove_emojis(data):
96
 
97
  def predict(text, target, chosen_model):
98
  # model1 = tf.keras.models.load_model(chosen_model, custom_objects={"TFBertModel": TFBertModel})
 
 
 
 
 
99
  model1 = from_pretrained_keras(chosen_model)
100
 
101
  checkpoint = kw_to_hf[chosen_model] # "neuralmind/bert-base-portuguese-cased"
 
62
  ]
63
 
64
 
 
65
  def remove_emojis(data):
66
  if '@' in data:
67
  data = re.sub(r"(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z0-9-_]+[A-Za-z0-9-_]+)", "", data).strip()
 
95
 
96
  def predict(text, target, chosen_model):
97
  # model1 = tf.keras.models.load_model(chosen_model, custom_objects={"TFBertModel": TFBertModel})
98
+
99
+ if '-cleantxt' in chosen_model:
100
+ text = remove_emojis(text)
101
+ target = remove_emojis(target)
102
+
103
  model1 = from_pretrained_keras(chosen_model)
104
 
105
  checkpoint = kw_to_hf[chosen_model] # "neuralmind/bert-base-portuguese-cased"