# app.py import streamlit as st from guardian import fetch_headlines, fetch_full_article from memes import article_to_meme st.set_page_config(page_title="The Meme York Times", layout="wide") st.title("📰➡️ Meme York Times") # Sidebar controls section = st.sidebar.selectbox("Section", ["world", "technology", "science", "culture"]) num = st.sidebar.slider("Number of articles", 1, 10, 5) with st.spinner("Fetching articles…"): articles = fetch_headlines(section, num) for headline, url in articles: st.markdown(f"**{headline}**") try: full_text = fetch_full_article(url) meme_url = article_to_meme(full_text) # Display the meme image st.image(meme_url, use_container_width=True) # Display the raw meme URL below the image # st.markdown(meme_url) except Exception as e: st.error(f"Error generating meme: {e}")