Spaces:
Sleeping
Sleeping
Vela
commited on
Commit
·
5c89452
1
Parent(s):
9bb7299
modified app.py files
Browse files- .gitignore +1 -0
- app.py +13 -14
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv
|
app.py
CHANGED
@@ -3,30 +3,29 @@ import data
|
|
3 |
import models
|
4 |
|
5 |
def main():
|
6 |
-
st.title("
|
7 |
|
8 |
uploaded_file = st.file_uploader("Upload CSV or Excel file", type=["csv", "xlsx"])
|
|
|
9 |
classifier = models.load_model()
|
10 |
-
|
11 |
-
|
12 |
if uploaded_file:
|
|
|
|
|
|
|
|
|
13 |
column = list(df.columns)
|
14 |
column_with_empty = [""] + column
|
15 |
text_to_analyze = st.selectbox("Select text column", column_with_empty)
|
16 |
|
17 |
-
|
18 |
-
|
19 |
if text_to_analyze in df.columns:
|
20 |
text_column = text_to_analyze
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
st.subheader("Processed Data Preview")
|
29 |
-
st.dataframe(df.head())
|
30 |
|
31 |
if __name__ == "__main__":
|
32 |
-
main()
|
|
|
3 |
import models
|
4 |
|
5 |
def main():
|
6 |
+
st.title("Sentiment Analysis")
|
7 |
|
8 |
uploaded_file = st.file_uploader("Upload CSV or Excel file", type=["csv", "xlsx"])
|
9 |
+
|
10 |
classifier = models.load_model()
|
11 |
+
|
|
|
12 |
if uploaded_file:
|
13 |
+
df = data.read_data(uploaded_file)
|
14 |
+
if df is not None:
|
15 |
+
st.write("✅ File Uploaded Successfully!")
|
16 |
+
|
17 |
column = list(df.columns)
|
18 |
column_with_empty = [""] + column
|
19 |
text_to_analyze = st.selectbox("Select text column", column_with_empty)
|
20 |
|
|
|
|
|
21 |
if text_to_analyze in df.columns:
|
22 |
text_column = text_to_analyze
|
23 |
|
24 |
+
df = models.analyze_sentiments(df, text_column, classifier)
|
25 |
+
data.visualize_data(df, st)
|
26 |
+
st.subheader("Processed Data Preview")
|
27 |
+
st.dataframe(df.head())
|
28 |
+
st.download_button("Download Results", df.to_csv(index=False).encode('utf-8'), "sentiment_results.csv", "text/csv")
|
|
|
|
|
|
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
+
main()
|