nebiyu29 commited on
Commit
4cb0b72
1 Parent(s): 6834265

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +27 -0
main.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import srteamlit as st
2
+
3
+ from transformers import AutoModelForSequenceClassification
4
+ from transformers import TextClassificationPipeline
5
+ from transformers import AutoTokenizer
6
+
7
+ model_name="nebiyu29/finetunned_version_2"
8
+
9
+
10
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
11
+ model=AutoModelForSequenceClassification.from_pretrained(model_name)
12
+
13
+ classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer)
14
+
15
+ #classifiy model
16
+ def classify(text):
17
+ result=classifier(text)
18
+ return result
19
+
20
+ #streamlit part
21
+ user_input = st.text_input("Enter some text to generate:")
22
+
23
+ if user_input:
24
+ classified_text = classify(user_input)
25
+ st.text("classified Text:")
26
+ st.write(classified_text)
27
+