Spaces:
Running
Running
Commit
•
3181725
1
Parent(s):
05cf3a9
Update index.html
Browse files- index.html +35 -13
index.html
CHANGED
@@ -7,18 +7,40 @@
|
|
7 |
<link rel="stylesheet" href="style.css" />
|
8 |
</head>
|
9 |
<body>
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
</body>
|
24 |
</html>
|
|
|
7 |
<link rel="stylesheet" href="style.css" />
|
8 |
</head>
|
9 |
<body>
|
10 |
+
<header>
|
11 |
+
<h1>Stance Prediction on Latest News</h1>
|
12 |
+
</header>
|
13 |
+
<nav>
|
14 |
+
<ul>
|
15 |
+
<li><a href="https://modal.com/apps/dhruvshettty/biweekly_pipeline">Modal Biweekly Pipeline</a></li>
|
16 |
+
<li><a href="https://modal.com/apps/dhruvshettty/daily_pipeline">Modal Daily Pipeline</a></li>
|
17 |
+
<li><a href="https://modal.com/apps/dhruvshettty/latest_news_webhook">Modal Articles Webhook</a></li>
|
18 |
+
</ul>
|
19 |
+
</nav>
|
20 |
+
<section id="main-content">
|
21 |
+
<button id="get-articles" type="button">Get recent articles...</button>
|
22 |
+
</section>
|
23 |
+
|
24 |
+
<script
|
25 |
+
const endpoint = 'https://dhruvshettty--latest-news-webhook-response-articles.modal.run/';
|
26 |
+
|
27 |
+
document.getElementById("get-articles").onclick = function() {
|
28 |
+
fetch(endpoint)
|
29 |
+
.then(response => response.json())
|
30 |
+
.then(data => {
|
31 |
+
const mainContent = document.getElementById("main-content");
|
32 |
+
data.forEach(post => {
|
33 |
+
const article = document.createElement('article');
|
34 |
+
article.innerHTML = `
|
35 |
+
<h2>${post.title}</h2>
|
36 |
+
<p>Published on ${post.publishedat}</p>
|
37 |
+
<p>Categories: ${post.predicted_topic}</p>
|
38 |
+
<p>Stance: ${post.predicted_stance}</p>
|
39 |
+
`;
|
40 |
+
mainContent.appendChild(article);
|
41 |
+
})
|
42 |
+
.catch(error => console.error(error));
|
43 |
+
}
|
44 |
+
</script>
|
45 |
</body>
|
46 |
</html>
|