Howosn commited on
Commit
04ef5d4
1 Parent(s): 5fb4813

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -12
app.py CHANGED
@@ -2,19 +2,8 @@ import streamlit as st
2
  from transformers import pipeline
3
  from transformers import T5ForConditionalGeneration, T5Tokenizer
4
 
5
- def tras_sum(input):
6
- model_name = 'utrobinmv/t5_summary_en_ru_zh_base_2048'
7
- model = T5ForConditionalGeneration.from_pretrained(model_name)
8
- tokenizer = T5Tokenizer.from_pretrained(model_name)
9
- # text summary generate
10
- prefix = 'summary to en: '
11
- src_text = prefix + input
12
- input_ids = tokenizer(src_text, return_tensors="pt")
13
- generated_tokens = model.generate(**input_ids)
14
- traslated_summary = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
15
- return traslated_summary
16
-
17
  # Load the summarization & translation model pipeline
 
18
  sentiment_pipeline = pipeline("text-classification", model='Howosn/Sentiment_Model',return_all_scores=True)
19
 
20
  # Streamlit application title
 
2
  from transformers import pipeline
3
  from transformers import T5ForConditionalGeneration, T5Tokenizer
4
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # Load the summarization & translation model pipeline
6
+ tran_sum_pipe = pipeline("translation", model='utrobinmv/t5_summary_en_ru_zh_base_2048',return_all_scores=True)
7
  sentiment_pipeline = pipeline("text-classification", model='Howosn/Sentiment_Model',return_all_scores=True)
8
 
9
  # Streamlit application title