Update app.py
Browse files38 unmodified lines39404142434445434647484950518 unmodified lines60616263646566676162636869707172731 unmodified line757677787980818227 unmodified lines11011111211311411511638 unmodified lines st.write('▶️ Translation model start downing, loading model may takes time, please wait...') trans_pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-zh-en") st.write('⏺️ Translation model successfully loaded') st.write('▶️ Start translating...') translation_progress_count = 0 translation_bar = st.progress(0) for i in filtered_data: st.write(trans_pipe(i)[0]['translation_text']) translated_data.append(trans_pipe(i)[0]['translation_text']) translation_progress_count += 1/len(filtered_data) translation_bar.progress(translation_progress_count) elif language_Classification == 'en': st.write("Your input is English, moving to next stage...") translated_data = [i for i in filtered_data]8 unmodified lines st.write('⏺️ Classification model successfully loaded') negative_count, neutral_count, positive_count = 0,0,0 negative_dict = {} emotion_progress_count = 0 st.write('▶️ Data processing ...') emotion_bar = st.progress(0) for i in translated_data: labelled_result = emo_pipe(i)[0]['label'] st.write('Text: ',i) st.write('Label: ',labelled_result) st.write(' ') # st.write('Text: ',i) # st.write('Label: ',labelled_result) # st.write(' ') if labelled_result == 'negative': negative_dict[i] = emo_pipe(i)[0]['score'] negative_count += 11 unmodified line neutral_count += 1 if labelled_result == 'positive': positive_count += 1 emotion_progress_count += 1/len(translated_data) emotion_bar.progress(emotion_progress_count) sizes = [negative_count, neutral_count, positive_count] labels = ['negative_review', 'neutral_review', 'positive_review'] # 创建饼状图27 unmodified lines st.write('▶️ Summarizatio model start downing, loading model may takes time, please wait...') summarize_pipe = pipeline("text2text-generation", model="deeplearningwithpython5240/summarisation-t5-finetuned-model", max_new_tokens =512) st.write('⏺️ Summarization model successfully loaded') st.write('▶️ Summarizing...') summarized_text = summarize_pipe(top10_negative_str) return summarized_text
app.py+14-4