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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def main():
|
4 |
+
# Main Container
|
5 |
+
st.markdown('<div class="main-container">', unsafe_allow_html=True)
|
6 |
+
|
7 |
+
# Custom CSS with Poppins font
|
8 |
+
st.markdown("""
|
9 |
+
<style>
|
10 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
|
11 |
+
|
12 |
+
* {
|
13 |
+
font-family: 'Poppins', sans-serif !important;
|
14 |
+
box-sizing: border-box;
|
15 |
+
}
|
16 |
+
|
17 |
+
.stApp {
|
18 |
+
background: #ffffff;
|
19 |
+
min-height: 100vh;
|
20 |
+
color: #1f2a44;
|
21 |
+
}
|
22 |
+
|
23 |
+
#MainMenu {visibility: hidden;}
|
24 |
+
footer {visibility: hidden;}
|
25 |
+
.stDeployButton {display: none;}
|
26 |
+
header {visibility: hidden;}
|
27 |
+
.stApp > header {visibility: hidden;}
|
28 |
+
|
29 |
+
/* Main Container */
|
30 |
+
.main-container {
|
31 |
+
max-width: 1200px;
|
32 |
+
margin: 0 auto;
|
33 |
+
padding: 1rem 2rem;
|
34 |
+
}
|
35 |
+
|
36 |
+
/* Header Section */
|
37 |
+
.header-section {
|
38 |
+
text-align: center;
|
39 |
+
margin-bottom: 2.5rem;
|
40 |
+
padding: 1.5rem 0;
|
41 |
+
background: linear-gradient(135deg, #f4f7fa 0%, #e8f0fe 100%);
|
42 |
+
border-radius: 12px;
|
43 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
44 |
+
}
|
45 |
+
|
46 |
+
.header-title {
|
47 |
+
font-size: 2.25rem;
|
48 |
+
font-weight: 700;
|
49 |
+
color: #1f2a44;
|
50 |
+
margin: 0;
|
51 |
+
}
|
52 |
+
|
53 |
+
/* Section Styling */
|
54 |
+
.section {
|
55 |
+
margin-bottom: 2.5rem;
|
56 |
+
max-width: 1200px;
|
57 |
+
margin-left: auto;
|
58 |
+
margin-right: auto;
|
59 |
+
padding: 0 1rem;
|
60 |
+
}
|
61 |
+
|
62 |
+
.section-title {
|
63 |
+
font-size: 1.5rem;
|
64 |
+
font-weight: 600;
|
65 |
+
color: #1f2a44;
|
66 |
+
margin-bottom: 1rem;
|
67 |
+
display: flex;
|
68 |
+
align-items: center;
|
69 |
+
gap: 0.5rem;
|
70 |
+
}
|
71 |
+
|
72 |
+
.section-text {
|
73 |
+
font-size: 0.95rem;
|
74 |
+
color: #6b7280;
|
75 |
+
line-height: 1.6;
|
76 |
+
max-width: 800px;
|
77 |
+
margin: 0 auto;
|
78 |
+
}
|
79 |
+
|
80 |
+
.code-block {
|
81 |
+
background: #f4f7fa;
|
82 |
+
padding: 1.2rem;
|
83 |
+
border-radius: 8px;
|
84 |
+
font-size: 0.9rem;
|
85 |
+
color: #1f2a44;
|
86 |
+
margin: 1rem 0;
|
87 |
+
overflow-x: auto;
|
88 |
+
border-left: 4px solid #6366f1;
|
89 |
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
|
90 |
+
}
|
91 |
+
|
92 |
+
.code-block pre {
|
93 |
+
margin: 0;
|
94 |
+
font-family: 'Poppins', sans-serif;
|
95 |
+
white-space: pre-wrap;
|
96 |
+
line-height: 1.5;
|
97 |
+
}
|
98 |
+
|
99 |
+
.step-list {
|
100 |
+
list-style-type: decimal;
|
101 |
+
padding-left: 2rem;
|
102 |
+
margin: 1rem 0;
|
103 |
+
}
|
104 |
+
|
105 |
+
.step-list li {
|
106 |
+
margin-bottom: 0.8rem;
|
107 |
+
color: #4a5568;
|
108 |
+
}
|
109 |
+
|
110 |
+
.highlight {
|
111 |
+
color: #2d3748;
|
112 |
+
font-weight: 500;
|
113 |
+
}
|
114 |
+
|
115 |
+
/* Footer */
|
116 |
+
.footer {
|
117 |
+
border-top: 1px solid #e5e7eb;
|
118 |
+
padding: 2.5rem 0;
|
119 |
+
text-align: center;
|
120 |
+
max-width: 1200px;
|
121 |
+
margin: 2rem auto 0;
|
122 |
+
background: linear-gradient(135deg, #e8f0fe 0%, #f8f9fa 100%);
|
123 |
+
border-radius: 12px;
|
124 |
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
125 |
+
}
|
126 |
+
|
127 |
+
.footer-content {
|
128 |
+
display: flex;
|
129 |
+
flex-direction: column;
|
130 |
+
gap: 1rem;
|
131 |
+
}
|
132 |
+
|
133 |
+
.footer p {
|
134 |
+
font-size: 0.9rem;
|
135 |
+
color: #4b5eaa;
|
136 |
+
font-weight: 600;
|
137 |
+
margin: 0;
|
138 |
+
}
|
139 |
+
|
140 |
+
.footer a {
|
141 |
+
color: #3b82f6;
|
142 |
+
text-decoration: none;
|
143 |
+
transition: color 0.3s ease;
|
144 |
+
}
|
145 |
+
|
146 |
+
.footer a:hover {
|
147 |
+
color: #1e40af;
|
148 |
+
text-decoration: underline;
|
149 |
+
}
|
150 |
+
|
151 |
+
.footer .social-links {
|
152 |
+
display: flex;
|
153 |
+
justify-content: center;
|
154 |
+
gap: 1.5rem;
|
155 |
+
margin-top: 1rem;
|
156 |
+
}
|
157 |
+
|
158 |
+
.footer .social-links a {
|
159 |
+
font-size: 1.2rem;
|
160 |
+
color: #4b5eaa;
|
161 |
+
transition: color 0.3s ease;
|
162 |
+
}
|
163 |
+
|
164 |
+
.footer .social-links a:hover {
|
165 |
+
color: #3b82f6;
|
166 |
+
}
|
167 |
+
|
168 |
+
/* Responsive Design */
|
169 |
+
@media (max-width: 1024px) {
|
170 |
+
.main-container {
|
171 |
+
padding: 1rem;
|
172 |
+
}
|
173 |
+
.section {
|
174 |
+
padding: 0 0.5rem;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
@media (max-width: 768px) {
|
179 |
+
.header-title {
|
180 |
+
font-size: 1.75rem;
|
181 |
+
}
|
182 |
+
.section-title {
|
183 |
+
font-size: 1.25rem;
|
184 |
+
}
|
185 |
+
.section-text {
|
186 |
+
font-size: 0.9rem;
|
187 |
+
}
|
188 |
+
.code-block {
|
189 |
+
font-size: 0.85rem;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
@media (max-width: 480px) {
|
194 |
+
.header-title {
|
195 |
+
font-size: 1.5rem;
|
196 |
+
}
|
197 |
+
.section-title {
|
198 |
+
font-size: 1.1rem;
|
199 |
+
}
|
200 |
+
.section-text {
|
201 |
+
font-size: 0.85rem;
|
202 |
+
}
|
203 |
+
.code-block {
|
204 |
+
font-size: 0.8rem;
|
205 |
+
}
|
206 |
+
.footer-content {
|
207 |
+
gap: 0.5rem;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
</style>
|
211 |
+
""", unsafe_allow_html=True)
|
212 |
+
|
213 |
+
# Header Section
|
214 |
+
|
215 |
+
st.markdown('<h1 class="header-title">🌐 TruthCheck - Open Source</h1>', unsafe_allow_html=True)
|
216 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
217 |
+
|
218 |
+
# Open Source Initiative
|
219 |
+
st.markdown('<div class="section">', unsafe_allow_html=True)
|
220 |
+
st.markdown('<h2 class="section-title">ℹ️ Open Source Vision</h2>', unsafe_allow_html=True)
|
221 |
+
st.markdown('<p class="section-text">TruthCheck is an open-source powerhouse dedicated to combating misinformation with cutting-edge AI. We warmly invite innovators, developers, and data enthusiasts worldwide to join us. Your expertise can elevate our hybrid BERT-BiLSTM model, expand its reach, and redefine digital trust—together, we can make a lasting impact!</p>', unsafe_allow_html=True)
|
222 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
223 |
+
|
224 |
+
# Getting Started
|
225 |
+
st.markdown('<div class="section">', unsafe_allow_html=True)
|
226 |
+
st.markdown('<h2 class="section-title">🚀 Get Started Now</h2>', unsafe_allow_html=True)
|
227 |
+
st.markdown('<p class="section-text">Dive into TruthCheck by cloning and running it locally from our Hugging Face repository. Follow these steps to begin your journey:</p>', unsafe_allow_html=True)
|
228 |
+
st.markdown('<ol class="step-list">', unsafe_allow_html=True)
|
229 |
+
st.markdown('<li><span class="highlight">Clone the Repository:</span> Secure the codebase with this command:</li>', unsafe_allow_html=True)
|
230 |
+
st.markdown('<div class="code-block"><pre>git clone https://huggingface.co/spaces/adnaan05/TruthCheck</pre></div>', unsafe_allow_html=True)
|
231 |
+
st.markdown('<li><span class="highlight">Navigate to Directory:</span> Enter the project folder:</li>', unsafe_allow_html=True)
|
232 |
+
st.markdown('<div class="code-block"><pre>cd TruthCheck</pre></div>', unsafe_allow_html=True)
|
233 |
+
st.markdown('<li><span class="highlight">Install Dependencies:</span> Set up the environment with:</li>', unsafe_allow_html=True)
|
234 |
+
st.markdown('<div class="code-block"><pre>pip install -r requirements.txt</pre></div>', unsafe_allow_html=True)
|
235 |
+
st.markdown('<li><span class="highlight">Launch the App:</span> Start the application with:</li>', unsafe_allow_html=True)
|
236 |
+
st.markdown('<div class="code-block"><pre>streamlit run app.py</pre></div>', unsafe_allow_html=True)
|
237 |
+
st.markdown('</ol>', unsafe_allow_html=True)
|
238 |
+
st.markdown('<p class="section-text">Explore the full codebase and details on our <a href="https://huggingface.co/spaces/adnaan05/TruthCheck" target="_blank">Hugging Face page</a>.</p>', unsafe_allow_html=True)
|
239 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
240 |
+
|
241 |
+
# Contributing via Pull Requests
|
242 |
+
st.markdown('<div class="section">', unsafe_allow_html=True)
|
243 |
+
st.markdown('<h2 class="section-title">🤝 Contribute with Pull Requests</h2>', unsafe_allow_html=True)
|
244 |
+
st.markdown('<p class="section-text">Your contributions shape TruthCheck’s future. Here’s how to submit a pull request on Hugging Face:</p>', unsafe_allow_html=True)
|
245 |
+
st.markdown('<ol class="step-list">', unsafe_allow_html=True)
|
246 |
+
st.markdown('<li><span class="highlight">Fork the Repository:</span> Create your own copy at <a href="https://huggingface.co/spaces/adnaan05/TruthCheck" target="_blank">https://huggingface.co/spaces/adnaan05/TruthCheck</a>.</li>', unsafe_allow_html=True)
|
247 |
+
st.markdown('<li><span class="highlight">Clone Your Fork:</span> Download it locally:</li>', unsafe_allow_html=True)
|
248 |
+
st.markdown('<div class="code-block"><pre>git clone https://huggingface.co/spaces/your-username/TruthCheck</pre></div>', unsafe_allow_html=True)
|
249 |
+
st.markdown('<li><span class="highlight">Create a Branch:</span> Start your work with:</li>', unsafe_allow_html=True)
|
250 |
+
st.markdown('<div class="code-block"><pre>git checkout -b feature/your-feature-name</pre></div>', unsafe_allow_html=True)
|
251 |
+
st.markdown('<li><span class="highlight">Make Changes:</span> Implement your improvements and commit:</li>', unsafe_allow_html=True)
|
252 |
+
st.markdown('<div class="code-block"><pre>git add .\ngit commit -m "Add your detailed message here"</pre></div>', unsafe_allow_html=True)
|
253 |
+
st.markdown('<li><span class="highlight">Push to Your Fork:</span> Upload your branch:</li>', unsafe_allow_html=True)
|
254 |
+
st.markdown('<div class="code-block"><pre>git push origin feature/your-feature-name</pre></div>', unsafe_allow_html=True)
|
255 |
+
st.markdown('<li><span class="highlight">Open a Pull Request:</span> Submit via the Hugging Face interface, detailing your changes and linking to issues.</li>', unsafe_allow_html=True)
|
256 |
+
st.markdown('</ol>', unsafe_allow_html=True)
|
257 |
+
st.markdown('<p class="section-text">Join discussions and find tasks on the <a href="https://huggingface.co/spaces/adnaan05/TruthCheck/discussions" target="_blank">community tab</a>.</p>', unsafe_allow_html=True)
|
258 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
259 |
+
|
260 |
+
# Why Contribute
|
261 |
+
st.markdown('<div class="section">', unsafe_allow_html=True)
|
262 |
+
st.markdown('<h2 class="section-title">🌍 Why Contribute?</h2>', unsafe_allow_html=True)
|
263 |
+
st.markdown('<p class="section-text">Contributing to TruthCheck means joining a global mission to empower truth. Enhance our AI with new datasets, add multilingual capabilities, or refine the UI—your input drives progress. Let’s build a trustworthy digital future together!</p>', unsafe_allow_html=True)
|
264 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
265 |
+
|
266 |
+
# Footer
|
267 |
+
st.markdown("---")
|
268 |
+
st.markdown(
|
269 |
+
'<p style="text-align: center; font-weight: 600; font-size: 16px;">💻 Developed with ❤️ using Streamlit | © 2025</p>',
|
270 |
+
unsafe_allow_html=True
|
271 |
+
)
|
272 |
+
|
273 |
+
st.markdown('</div>', unsafe_allow_html=True) # Close main-container
|
274 |
+
|
275 |
+
if __name__ == "__main__":
|
276 |
+
main()
|