-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (18 loc) · 769 Bytes
/
app.py
File metadata and controls
24 lines (18 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
from src.inference import predict_sentiment
import json
st.set_page_config(page_title="Flipkart Sentiment Analyzer", layout="centered")
st.title("Flipkart Review Sentiment Analyzer")
st.write("Real-time sentiment prediction using an MLOps-trained model")
review = st.text_area("Enter your review:")
if st.button("Analyze Sentiment"):
if review.strip():
result = predict_sentiment(review)
st.success(f"Sentiment: {result}")
else:
st.warning("Please enter a review.")
with open("artifacts/model_metadata.json") as f:
metadata = json.load(f)
st.sidebar.header("Model Info")
st.sidebar.write(f"Model: {metadata['model_name']}")
st.sidebar.write(f"F1 Score: {metadata['f1_score']:.4f}")