Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,33 +1,36 @@
|
|
| 1 |
-
|
| 2 |
-
from mca_comment_analyzer import MCACommentAnalyzerLight
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
comments = manual_input.strip().split("\n")
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
st.bar_chart(df["Sentiment"].value_counts())
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
st.
|
| 32 |
else:
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
|
|
|
| 2 |
|
| 3 |
+
# -----------------------------
|
| 4 |
+
# 1️⃣ Hugging Face cache fix
|
| 5 |
+
# -----------------------------
|
| 6 |
+
import os
|
| 7 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/cache"
|
| 8 |
|
| 9 |
+
# -----------------------------
|
| 10 |
+
# 2️⃣ Streamlit import
|
| 11 |
+
# -----------------------------
|
| 12 |
+
import streamlit as st
|
| 13 |
|
| 14 |
+
# -----------------------------
|
| 15 |
+
# 3️⃣ Local module import
|
| 16 |
+
# -----------------------------
|
| 17 |
+
from mca_comment_analyzer import MCACommentAnalyzerLight # check class name in your file
|
|
|
|
| 18 |
|
| 19 |
+
# -----------------------------
|
| 20 |
+
# 4️⃣ Streamlit App
|
| 21 |
+
# -----------------------------
|
| 22 |
+
st.title("MCA Comment Analyzer Light 📝")
|
| 23 |
|
| 24 |
+
# Example usage
|
| 25 |
+
st.write("Upload your comment file or input text below:")
|
| 26 |
|
| 27 |
+
user_input = st.text_area("Enter comment text:")
|
|
|
|
| 28 |
|
| 29 |
+
if st.button("Analyze"):
|
| 30 |
+
if user_input.strip() == "":
|
| 31 |
+
st.warning("Please enter some text!")
|
| 32 |
else:
|
| 33 |
+
analyzer = MCACommentAnalyzerLight()
|
| 34 |
+
result = analyzer.analyze(user_input) # replace analyze() with your actual function
|
| 35 |
+
st.success("Analysis Result:")
|
| 36 |
+
st.write(result)
|