Kleo commited on
Commit
9484c94
1 Parent(s): c6aa8ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -7
app.py CHANGED
@@ -10,7 +10,7 @@ Original file is located at
10
  import gradio as gr
11
  from transformers import BertTokenizer, TFBertForSequenceClassification
12
  import tensorflow as tf
13
- #from transformers import pipeline
14
 
15
  # Load tokenizer
16
  tokenizer = BertTokenizer.from_pretrained("nlpaueb/bert-base-greek-uncased-v1")
@@ -24,18 +24,12 @@ def check_sarcasm(sentence):
24
  tf_outputs = model(tf_batch.input_ids, tf_batch.token_type_ids)
25
  tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
26
  pred_label = tf.argmax(tf_predictions, axis=1)
27
- #pred_label=pipeline(sentence)
28
 
29
  if pred_label == 1:
30
  return "Sarcastic"
31
  else:
32
  return "Not sarcastic"
33
 
34
- # Example usage
35
- #sentence = "Μεξικό: 25 νεκροί από την πτώση λεωφορείου στον γκρεμό"
36
- #result = check_sarcasm(sentence)
37
- #print(result)
38
-
39
 
40
  # Create a Gradio interface
41
  iface = gr.Interface(
 
10
  import gradio as gr
11
  from transformers import BertTokenizer, TFBertForSequenceClassification
12
  import tensorflow as tf
13
+
14
 
15
  # Load tokenizer
16
  tokenizer = BertTokenizer.from_pretrained("nlpaueb/bert-base-greek-uncased-v1")
 
24
  tf_outputs = model(tf_batch.input_ids, tf_batch.token_type_ids)
25
  tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
26
  pred_label = tf.argmax(tf_predictions, axis=1)
 
27
 
28
  if pred_label == 1:
29
  return "Sarcastic"
30
  else:
31
  return "Not sarcastic"
32
 
 
 
 
 
 
33
 
34
  # Create a Gradio interface
35
  iface = gr.Interface(