Spaces:
Running
Running
Update UI
Browse files
app.py
CHANGED
@@ -112,7 +112,7 @@ def categorize(url):
|
|
112 |
|
113 |
|
114 |
# Main App
|
115 |
-
st.
|
116 |
st.write("Unsure what category a CNN article belongs to? Our clever tool can help! Paste the URL below and press Enter. We'll sort it into one of our 5 categories in a flash! β‘οΈ")
|
117 |
|
118 |
# Define category information (modify content and bullet points as needed)
|
@@ -143,7 +143,16 @@ categories = {
|
|
143 |
"Stay updated on celebrity news and cultural trends."
|
144 |
]
|
145 |
}
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
with st.expander("Category List"):
|
148 |
# Title for each category
|
149 |
st.subheader("Available Categories:")
|
@@ -156,6 +165,17 @@ with st.expander("Category List"):
|
|
156 |
for item in content:
|
157 |
st.write(f"- {item}")
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
# Explain to user why this project is only worked for CNN domain
|
160 |
with st.expander("Tips", expanded=True):
|
161 |
st.write(
|
@@ -172,8 +192,10 @@ if url:
|
|
172 |
st.divider() # π Draws a horizontal rule
|
173 |
result = categorize(url)
|
174 |
article_content = result.get('Article_Content')
|
175 |
-
st.
|
|
|
176 |
st.divider() # π Draws a horizontal rule
|
|
|
177 |
st.json({
|
178 |
"Logistic": result.get("Logistic_Predicted"),
|
179 |
"SVC": result.get("SVM_Predicted")
|
|
|
112 |
|
113 |
|
114 |
# Main App
|
115 |
+
st.title('Classification Project')
|
116 |
st.write("Unsure what category a CNN article belongs to? Our clever tool can help! Paste the URL below and press Enter. We'll sort it into one of our 5 categories in a flash! β‘οΈ")
|
117 |
|
118 |
# Define category information (modify content and bullet points as needed)
|
|
|
143 |
"Stay updated on celebrity news and cultural trends."
|
144 |
]
|
145 |
}
|
146 |
+
|
147 |
+
# Define model information (modify descriptions as needed)
|
148 |
+
models = {
|
149 |
+
"Logistic Regression": "A widely used statistical method for classification problems. It excels at identifying linear relationships between features and the target variable.",
|
150 |
+
"SVC (Support Vector Classifier)": "A powerful machine learning model that seeks to find a hyperplane that best separates data points of different classes. It's effective for high-dimensional data and can handle some non-linear relationships.",
|
151 |
+
"LSTM (Long Short-Term Memory)": "A type of recurrent neural network (RNN) particularly well-suited for sequential data like text or time series. LSTMs can effectively capture long-term dependencies within the data.",
|
152 |
+
"BERT (Bidirectional Encoder Representations from Transformers)": "A powerful pre-trained model based on the Transformer architecture. It excels at understanding the nuances of language and can be fine-tuned for various NLP tasks like text classification."
|
153 |
+
}
|
154 |
+
|
155 |
+
# Create expanders containing list of categories can be classified
|
156 |
with st.expander("Category List"):
|
157 |
# Title for each category
|
158 |
st.subheader("Available Categories:")
|
|
|
165 |
for item in content:
|
166 |
st.write(f"- {item}")
|
167 |
|
168 |
+
|
169 |
+
# Create expanders containing list of models used in this project
|
170 |
+
with st.expander("Available Models"):
|
171 |
+
st.subheader("List of Models:")
|
172 |
+
for model_name in models.keys():
|
173 |
+
st.write(f"- {model_name}")
|
174 |
+
st.write("---")
|
175 |
+
for model_name, description in models.items():
|
176 |
+
st.subheader(model_name)
|
177 |
+
st.write(description)
|
178 |
+
|
179 |
# Explain to user why this project is only worked for CNN domain
|
180 |
with st.expander("Tips", expanded=True):
|
181 |
st.write(
|
|
|
192 |
st.divider() # π Draws a horizontal rule
|
193 |
result = categorize(url)
|
194 |
article_content = result.get('Article_Content')
|
195 |
+
st.title('Article Content Fetched')
|
196 |
+
st.text_area("", value=article_content, height=400) # render the article content as textarea element
|
197 |
st.divider() # π Draws a horizontal rule
|
198 |
+
st.title('Predicted Results')
|
199 |
st.json({
|
200 |
"Logistic": result.get("Logistic_Predicted"),
|
201 |
"SVC": result.get("SVM_Predicted")
|