The Streamlit web interface provides an intuitive, interactive way to classify news articles without writing code. Users can paste article text directly into a browser and get instant classification results.
st.title("📰 Detector de Noticias Falsas (IA)")st.markdown("---")st.header("Ingresa la noticia a clasificar:")# Text input areanoticia_input = st.text_area( "Pega el texto de la noticia aquí:", height=200, placeholder="Ej: The European Union formally approved a new trade agreement...")# Classification buttonif st.button("Clasificar Noticia"): if noticia_input: with st.spinner('Clasificando...'): # 1. Clean the text noticia_limpia = limpiar_texto(noticia_input) # 2. Vectorize using trained vectorizer noticia_vec = vectorizer.transform([noticia_limpia]) # 3. Make prediction prediccion = modelo.predict(noticia_vec)[0] # 4. Display result st.markdown("### Resultado de la Clasificación:") if prediccion == 'real': st.success(f"✅ La noticia es clasificada como **{prediccion.upper()}**") st.balloons() # Celebration animation else: st.error(f"❌ La noticia es clasificada como **{prediccion.upper()}**") else: st.warning("Por favor, pega el texto de una noticia para clasificar.")
Try these example news articles:Real News Example:
The European Union formally approved a new trade agreement with Canada on Thursday following a vote in the European Parliament in Brussels. Officials said the agreement is expected to strengthen economic cooperation and reduce tariffs on industrial goods over the next five years.
Fake News Example:
A secret meeting was held at the UN headquarters where delegates voted to replace all sugary drinks with green juice to boost the global population by 500 years.