Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -606,32 +606,42 @@ with tab1:
|
|
| 606 |
col_in, col_out = st.columns([1, 1], gap="large")
|
| 607 |
|
| 608 |
with col_in:
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
"
|
| 612 |
-
height=240,
|
| 613 |
-
placeholder="Paste your news article or headline here…\n\nExample:\n'BREAKING: Scientists discover miracle cure that Big Pharma is hiding!'",
|
| 614 |
-
label_visibility="collapsed",
|
| 615 |
-
)
|
| 616 |
|
| 617 |
-
#
|
| 618 |
-
st.markdown('<div class="card-label"
|
| 619 |
s1, s2 = st.columns(2)
|
| 620 |
with s1:
|
| 621 |
-
if st.button("Real News
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
|
|
|
|
|
|
|
|
|
| 626 |
with s2:
|
| 627 |
-
if st.button("Fake News
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
|
|
|
| 634 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 636 |
|
| 637 |
analyze_clicked = st.button("🔍 ANALYZE TEXT", key="analyze_btn")
|
|
|
|
| 606 |
col_in, col_out = st.columns([1, 1], gap="large")
|
| 607 |
|
| 608 |
with col_in:
|
| 609 |
+
# Init session state
|
| 610 |
+
if "news_text" not in st.session_state:
|
| 611 |
+
st.session_state["news_text"] = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
|
| 613 |
+
# Sample buttons BEFORE text area so state is set on rerun
|
| 614 |
+
st.markdown('<div class="card-label">🧪 Try Samples</div>', unsafe_allow_html=True)
|
| 615 |
s1, s2 = st.columns(2)
|
| 616 |
with s1:
|
| 617 |
+
if st.button("✅ Real News", key="real_sample"):
|
| 618 |
+
st.session_state["news_text"] = (
|
| 619 |
+
"NASA's James Webb Space Telescope has captured the deepest infrared "
|
| 620 |
+
"image of the universe ever taken, revealing thousands of galaxies that "
|
| 621 |
+
"existed over 13 billion years ago. The image was released in July 2022 "
|
| 622 |
+
"and marks a major milestone in space exploration and astrophysics."
|
| 623 |
+
)
|
| 624 |
+
st.rerun()
|
| 625 |
with s2:
|
| 626 |
+
if st.button("⚠️ Fake News", key="fake_sample"):
|
| 627 |
+
st.session_state["news_text"] = (
|
| 628 |
+
"SHOCKING!! Scientists EXPOSED: drinking hot lemon water CURES cancer in "
|
| 629 |
+
"30 days! Big Pharma has been HIDING this SECRET for decades to protect "
|
| 630 |
+
"their profits. SHARE before it gets DELETED!! You WON'T BELIEVE what "
|
| 631 |
+
"they don't want you to know!!"
|
| 632 |
+
)
|
| 633 |
+
st.rerun()
|
| 634 |
|
| 635 |
+
st.markdown('<div class="card"><div class="card-label">📝 Input Text</div>', unsafe_allow_html=True)
|
| 636 |
+
user_text = st.text_area(
|
| 637 |
+
"Article / Headline",
|
| 638 |
+
value=st.session_state["news_text"],
|
| 639 |
+
height=220,
|
| 640 |
+
placeholder="Paste your news article or headline here…",
|
| 641 |
+
label_visibility="collapsed",
|
| 642 |
+
key="news_textarea",
|
| 643 |
+
)
|
| 644 |
+
st.session_state["news_text"] = user_text
|
| 645 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 646 |
|
| 647 |
analyze_clicked = st.button("🔍 ANALYZE TEXT", key="analyze_btn")
|