File size: 4,050 Bytes
64e8657
82071aa
64e8657
82071aa
 
ac02d5d
82071aa
 
 
 
 
 
bfbca52
 
 
 
 
 
 
 
 
 
 
82071aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfbca52
82071aa
223cdd7
 
 
 
 
bfbca52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82071aa
 
 
 
 
 
ac02d5d
82071aa
 
 
 
 
bfbca52
 
82071aa
 
 
 
 
 
 
 
 
ac02d5d
 
82071aa
 
 
 
 
 
 
 
ac02d5d
82071aa
 
 
ac02d5d
82071aa
 
 
 
bfbca52
223cdd7
82071aa
 
 
 
 
 
 
bfbca52
 
 
 
 
 
 
 
 
 
82071aa
 
 
bfbca52
 
 
82071aa
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import streamlit as st
from rag import answer_question

# Set page config
st.set_page_config(
    page_title="Cory Booker's Marathon Speech", page_icon="๐Ÿ‡บ๐Ÿ‡ธ", layout="wide"
)

# Custom CSS
st.markdown(
    """
    <style>
    /* Force light mode */
    [data-testid="stAppViewContainer"] {
        background-color: #f8f9fa;
    }
    [data-testid="stSidebar"] {
        background-color: #f8f9fa;
    }
    .stApp {
        background-color: #f8f9fa;
        color: #000000;
    }
    .main {
        background-color: #f8f9fa;
    }
    .stButton>button {
        background-color: #1a237e;
        color: white;
        border-radius: 5px;
        padding: 10px 20px;
        border: none;
        font-weight: bold;
    }
    .stButton>button:hover {
        background-color: #0d47a1;
    }
    .stTextArea>div>div>textarea {
        border-radius: 5px;
        border: 2px solid #e0e0e0;
    }
    .highlight-text {
        background-color: #fff3cd;
        padding: 2px 5px;
        border-radius: 3px;
        font-weight: bold;
        color: #000000;
    }
    .answer-text {
        color: #000000;
        font-size: 16px;
        line-height: 1.6;
    }
    .section-title {
        color: #000000;
        font-weight: bold;
    }
    .section-text {
        color: #000000;
    }
    /* Override any dark mode styles */
    .stMarkdown {
        color: #000000;
    }
    .stTextInput>div>div>input {
        background-color: #ffffff;
        color: #000000;
    }
    </style>
""",
    unsafe_allow_html=True,
)

# Header with American flag emoji
st.title("๐Ÿ‡บ๐Ÿ‡ธ Cory Booker's Historic Speech")


st.markdown(
    """
    <div style='background-color: #ffffff; padding: 20px; border-radius: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-top: 20px;'>
        <h3 class="section-title">Source Material</h3>
        <p class="section-text">The transcript is derived from videos in this playlist: 
        <a href='https://www.youtube.com/playlist?list=PLeifkaZBt4JtdT8DZ7aftJ0lU0Q6Hfnvz' target='_blank'>YouTube Playlist</a></p>
    </div>
""",
    unsafe_allow_html=True,
)
# Search section
st.markdown(
    """
    <div style='background-color: #ffffff; padding: 20px; border-radius: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-top: 20px;'>
        <h2 class="section-title">Explore the Speech</h2>
        <p class="section-text">Ask questions about Senator Booker's historic <span class="highlight-text">25-hour speech</span> below:</p>
    </div>
""",
    unsafe_allow_html=True,
)

text = st.text_area(
    "Your Question",
    height=150,
    placeholder="What would you like to know about Senator Booker's speech?",
)

if st.button("Search", key="search_button"):
    with st.spinner("Searching through the historic transcript..."):
        response = answer_question(text)
        st.markdown(
            """
            <div style='background-color: #ffffff; padding: 20px; border-radius: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-top: 20px;'>
                <h3 class="section-title">Answer:</h3>
                <p class="answer-text">{}</p>
            </div>
        """.format(
                response
            ),
            unsafe_allow_html=True,
        )

        # Add disclaimer about LLM hallucinations
        st.markdown(
            """
            <div style='background-color: #fff3cd; padding: 15px; border-radius: 5px; margin-top: 20px; border: 1px solid #ffeeba;'>
                <p style='color: #856404; margin: 0;'>Please verify important facts and consult primary sources when possible.</p>
            </div>
        """,
            unsafe_allow_html=True,
        )

# Footer
st.markdown(
    """
    <div style='text-align: center; margin-top: 40px;'>
        <p class="section-text">๐Ÿ‡บ๐Ÿ‡ธ Celebrating American Democracy and the Power of Speech ๐Ÿ‡บ๐Ÿ‡ธ</p>
        <p class="section-text" style='font-size:   14px;'>Made with โค๏ธ by <a href="https://nkasmanoff.github.io/" target="_blank">Noah K</a></p>
    </div>
""",
    unsafe_allow_html=True,
)