import streamlit as st import tensorflow as tf import tensorflow_hub as hub new_model = tf.keras.models.load_model("best_model.h5",custom_objects={"KerasLayer": hub.KerasLayer}) def welcome(): return "Welcome to my app" def main(): st.title("Financial News Sentiment Analysis App") st.write( "This app tells you if the mentioned news is Fake or Real by using Natural Language Processing") html_temp = """

Financial News Sentiment Analysis

""" st.markdown(html_temp, unsafe_allow_html=True) text = st.text_input("Enter your Financial News") if st.button("Predict"): pred_prob = new_model.predict([text]) predict = tf.squeeze(tf.round(pred_prob)).numpy() st.subheader("Our Model thinks that ...") if predict >= 0.2: st.success( f"It's a Positive News.You can make your investment decision accordingly. Confidence Level is {pred_prob}%",icon="✅") elif predict <=-0.2: st.warning( f"It's a Negative News.Please Be Cautious. Confidence Level is {100 - pred_prob}%",icon="⚠️") else: st.warning( f"It's Neutral. Think twice before you take any investment decision. Confidence Level is {100 - pred_prob}%", icon="⚠️") if st.button("About"): st.text("Built with Streamlit") if __name__ == '__main__': main()