Yah216 commited on
Commit
d67547a
1 Parent(s): 01fcc4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -1,20 +1,26 @@
1
  import streamlit as st
2
  import tensorflow as tf
3
 
4
- from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
 
 
 
 
 
5
 
6
- tokenizer = AutoTokenizer.from_pretrained("Yah216/Sentiment_Analysis_CAMelBERT_msa_sixteenth_HARD")
7
 
8
- model = TFAutoModelForSequenceClassification.from_pretrained("Yah216/Sentiment_Analysis_CAMelBERT_msa_sixteenth_HARD")
9
 
10
- labels= model.config.label2id
11
 
12
  text = st.text_area("Enter some text in arabic language!")
13
  if text:
14
- out = tf.math.softmax(model(tokenizer(text, padding=True, truncation=True, return_tensors="np")).logits, axis = -1)
15
- res = out.numpy()
16
 
17
- labels['NEGATIVE'] = res[0,0]
18
- labels['NEUTRAL'] = res[0,1]
19
- labels['POSITIVE'] = res[0,2]
20
- st.json(labels)
 
1
  import streamlit as st
2
  import tensorflow as tf
3
 
4
+ from transformers import pipeline
5
+
6
+ model_ckpt = "Yah216/Sentiment_Analysis_CAMelBERT_msa_sixteenth_HARD"
7
+
8
+ pipe = pipeline("text clasification", model_ckpt)
9
+ #from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
10
 
11
+ #tokenizer = AutoTokenizer.from_pretrained("Yah216/Sentiment_Analysis_CAMelBERT_msa_sixteenth_HARD")
12
 
13
+ #model = TFAutoModelForSequenceClassification.from_pretrained("Yah216/Sentiment_Analysis_CAMelBERT_msa_sixteenth_HARD")
14
 
15
+ #labels= model.config.label2id
16
 
17
  text = st.text_area("Enter some text in arabic language!")
18
  if text:
19
+ #out = tf.math.softmax(model(tokenizer(text, padding=True, truncation=True, return_tensors="np")).logits, axis = -1)
20
+ # res = out.numpy()
21
 
22
+ # labels['NEGATIVE'] = res[0,0]
23
+ #labels['NEUTRAL'] = res[0,1]
24
+ #labels['POSITIVE'] = res[0,2]
25
+ # st.json(labels)
26
+ st.json(pipe(text))