articles-stance / index.html
dhruvshettty's picture
Update index.html
3181725
raw
history blame
1.78 kB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>My static Space</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header>
<h1>Stance Prediction on Latest News</h1>
</header>
<nav>
<ul>
<li><a href="https://modal.com/apps/dhruvshettty/biweekly_pipeline">Modal Biweekly Pipeline</a></li>
<li><a href="https://modal.com/apps/dhruvshettty/daily_pipeline">Modal Daily Pipeline</a></li>
<li><a href="https://modal.com/apps/dhruvshettty/latest_news_webhook">Modal Articles Webhook</a></li>
</ul>
</nav>
<section id="main-content">
<button id="get-articles" type="button">Get recent articles...</button>
</section>
<script
const endpoint = 'https://dhruvshettty--latest-news-webhook-response-articles.modal.run/';
document.getElementById("get-articles").onclick = function() {
fetch(endpoint)
.then(response => response.json())
.then(data => {
const mainContent = document.getElementById("main-content");
data.forEach(post => {
const article = document.createElement('article');
article.innerHTML = `
<h2>${post.title}</h2>
<p>Published on ${post.publishedat}</p>
<p>Categories: ${post.predicted_topic}</p>
<p>Stance: ${post.predicted_stance}</p>
`;
mainContent.appendChild(article);
})
.catch(error => console.error(error));
}
</script>
</body>
</html>