Spaces:
Running
Running
Update templates/index.html
Browse files- templates/index.html +2 -45
templates/index.html
CHANGED
@@ -58,7 +58,6 @@
|
|
58 |
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
59 |
transition: transform 0.2s;
|
60 |
overflow: hidden;
|
61 |
-
position: relative;
|
62 |
}
|
63 |
.article-tile:hover {
|
64 |
transform: scale(1.05);
|
@@ -79,33 +78,15 @@
|
|
79 |
.title a:hover {
|
80 |
color: #3498db;
|
81 |
}
|
82 |
-
.
|
83 |
color: #555;
|
84 |
font-size: 0.9em;
|
85 |
margin: 5px 0;
|
86 |
}
|
87 |
-
.sentiment {
|
88 |
-
font-style: italic;
|
89 |
-
color: #7f8c8d;
|
90 |
-
font-size: 0.85em;
|
91 |
-
}
|
92 |
.published {
|
93 |
font-size: 0.8em;
|
94 |
color: #95a5a6;
|
95 |
}
|
96 |
-
.summarize-btn {
|
97 |
-
background-color: #3498db;
|
98 |
-
color: white;
|
99 |
-
border: none;
|
100 |
-
padding: 5px 10px;
|
101 |
-
border-radius: 5px;
|
102 |
-
cursor: pointer;
|
103 |
-
font-size: 0.8em;
|
104 |
-
margin-top: 10px;
|
105 |
-
}
|
106 |
-
.summarize-btn:hover {
|
107 |
-
background-color: #2980b9;
|
108 |
-
}
|
109 |
#loading {
|
110 |
display: block;
|
111 |
position: fixed;
|
@@ -159,10 +140,8 @@
|
|
159 |
</svg>
|
160 |
{% endif %}
|
161 |
<div class="title"><a href="{{ article.link }}" target="_blank">{{ article.title }}</a></div>
|
162 |
-
<div class="
|
163 |
-
<div class="sentiment">Sentiment: {{ article.sentiment }}</div>
|
164 |
<div class="published">Published: {{ article.published }}</div>
|
165 |
-
<button class="summarize-btn" onclick="summarizeArticle('{{ article.original_description|escapejs }}', 'summary-{{ loop.index }}-{{ category|replace(' ', '-') }}')">Summarize</button>
|
166 |
</div>
|
167 |
{% endfor %}
|
168 |
</div>
|
@@ -182,28 +161,6 @@
|
|
182 |
loading.style.display = 'none';
|
183 |
});
|
184 |
});
|
185 |
-
|
186 |
-
function summarizeArticle(text, summaryId) {
|
187 |
-
const loading = document.getElementById('loading');
|
188 |
-
loading.style.display = 'block';
|
189 |
-
fetch('/summarize', {
|
190 |
-
method: 'POST',
|
191 |
-
headers: {
|
192 |
-
'Content-Type': 'application/json',
|
193 |
-
},
|
194 |
-
body: JSON.stringify({ text: text }),
|
195 |
-
})
|
196 |
-
.then(response => response.json())
|
197 |
-
.then(data => {
|
198 |
-
document.getElementById(summaryId).innerText = data.summary;
|
199 |
-
loading.style.display = 'none';
|
200 |
-
})
|
201 |
-
.catch(error => {
|
202 |
-
console.error('Error:', error);
|
203 |
-
document.getElementById(summaryId).innerText = 'Error summarizing';
|
204 |
-
loading.style.display = 'none';
|
205 |
-
});
|
206 |
-
}
|
207 |
</script>
|
208 |
</body>
|
209 |
</html>
|
|
|
58 |
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
59 |
transition: transform 0.2s;
|
60 |
overflow: hidden;
|
|
|
61 |
}
|
62 |
.article-tile:hover {
|
63 |
transform: scale(1.05);
|
|
|
78 |
.title a:hover {
|
79 |
color: #3498db;
|
80 |
}
|
81 |
+
.description {
|
82 |
color: #555;
|
83 |
font-size: 0.9em;
|
84 |
margin: 5px 0;
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
86 |
.published {
|
87 |
font-size: 0.8em;
|
88 |
color: #95a5a6;
|
89 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
#loading {
|
91 |
display: block;
|
92 |
position: fixed;
|
|
|
140 |
</svg>
|
141 |
{% endif %}
|
142 |
<div class="title"><a href="{{ article.link }}" target="_blank">{{ article.title }}</a></div>
|
143 |
+
<div class="description">{{ article.description }}</div>
|
|
|
144 |
<div class="published">Published: {{ article.published }}</div>
|
|
|
145 |
</div>
|
146 |
{% endfor %}
|
147 |
</div>
|
|
|
161 |
loading.style.display = 'none';
|
162 |
});
|
163 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
</script>
|
165 |
</body>
|
166 |
</html>
|