Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,8 @@ from transformers import pipeline
|
|
| 3 |
|
| 4 |
|
| 5 |
# Load the summarization & translation model pipeline
|
| 6 |
-
tran_sum_pipe = pipeline("translation", model='utrobinmv/t5_summary_en_ru_zh_base_2048')
|
|
|
|
| 7 |
sentiment_pipeline = pipeline("text-classification", model='Howosn/Sentiment_Model',return_all_scores=True)
|
| 8 |
#tokenizer = AutoTokenizer.from_pretrained('Howosn/Sentiment_Model', use_fast=False)
|
| 9 |
|
|
@@ -17,9 +18,9 @@ text = st.text_area("Enter the text", "")
|
|
| 17 |
# Perform analysis result when the user clicks the "Analyse" button
|
| 18 |
if st.button("Analyse"):
|
| 19 |
# Perform text classification on the input text
|
| 20 |
-
|
| 21 |
-
results = sentiment_pipeline(
|
| 22 |
-
|
| 23 |
# Display the classification result
|
| 24 |
max_score = float('-inf')
|
| 25 |
max_label = ''
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
# Load the summarization & translation model pipeline
|
| 6 |
+
#tran_sum_pipe = pipeline("translation", model='utrobinmv/t5_summary_en_ru_zh_base_2048')
|
| 7 |
+
trans_pipe = pipeline("translation", model='liam168/trans-opus-mt-zh-en')
|
| 8 |
sentiment_pipeline = pipeline("text-classification", model='Howosn/Sentiment_Model',return_all_scores=True)
|
| 9 |
#tokenizer = AutoTokenizer.from_pretrained('Howosn/Sentiment_Model', use_fast=False)
|
| 10 |
|
|
|
|
| 18 |
# Perform analysis result when the user clicks the "Analyse" button
|
| 19 |
if st.button("Analyse"):
|
| 20 |
# Perform text classification on the input text
|
| 21 |
+
trans = tran_pipe(text)[0]
|
| 22 |
+
results = sentiment_pipeline(trans)[0]
|
| 23 |
+
|
| 24 |
# Display the classification result
|
| 25 |
max_score = float('-inf')
|
| 26 |
max_label = ''
|