Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
def main():
|
| 5 |
+
st.set_page_config(page_title="Emotion analysis", page_icon="🦜")
|
| 6 |
+
st.header("Turn Your Input Into Sentiment Score")
|
| 7 |
+
uploaded_file = st.file_uploader("Upload CSV File", type="csv")
|
| 8 |
+
|
| 9 |
+
if uploaded_file is not None:
|
| 10 |
+
# Process the uploaded file
|
| 11 |
+
processed_data = process_uploaded_file(uploaded_file)
|
| 12 |
+
# Display the processed data or perform further actions
|
| 13 |
+
st.write(processed_data)
|
| 14 |
+
|
| 15 |
+
#Stage 1: Translate and summary the text from Chinese to English and summarize
|
| 16 |
+
st.text('Processing translation...')
|
| 17 |
+
trans = tras_sum(uploaded_file.name)
|
| 18 |
+
st.write(trans)
|
| 19 |
+
|
| 20 |
+
#Stage 2: Sentiment analysis
|
| 21 |
+
st.text('Generating a Sentiment result...')
|
| 22 |
+
senti = sentiment(trans)
|
| 23 |
+
st.write(senti)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
if __name__ == "__main__":
|
| 27 |
+
main()
|