Niansuh commited on
Commit
8e0231f
·
verified ·
1 Parent(s): 4090f37

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +98 -18
index.html CHANGED
@@ -1,19 +1,99 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Image Gallery</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #f4f4f4;
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+
15
+ .gallery {
16
+ display: grid;
17
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
18
+ gap: 10px;
19
+ padding: 20px;
20
+ margin-top: 20px;
21
+ }
22
+
23
+ .gallery img {
24
+ width: 100%;
25
+ height: auto;
26
+ border-radius: 8px;
27
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
28
+ transition: transform 0.3s ease-in-out;
29
+ }
30
+
31
+ .gallery img:hover {
32
+ transform: scale(1.05);
33
+ }
34
+
35
+ .container {
36
+ text-align: center;
37
+ margin-top: 20px;
38
+ }
39
+
40
+ h1 {
41
+ color: #333;
42
+ }
43
+
44
+ .loading {
45
+ font-size: 18px;
46
+ color: #666;
47
+ }
48
+ </style>
49
+ </head>
50
+ <body>
51
+
52
+ <div class="container">
53
+ <h1>AI Image Gallery</h1>
54
+ <p class="loading">Loading images...</p>
55
+ <div class="gallery" id="gallery"></div>
56
+ </div>
57
+
58
+ <script>
59
+ // Fetch the markdown file from the URL
60
+ const markdownUrl = "https://pub-fdaeaa9117e64f39ae731591e713d186.r2.dev/logs/imgnaicloud.txt";
61
+
62
+ // Fetch the markdown content
63
+ fetch(markdownUrl)
64
+ .then(response => response.text())
65
+ .then(markdownContent => {
66
+ // Parse the markdown content to extract image URLs
67
+ const imageUrls = parseImageUrls(markdownContent);
68
+
69
+ // Hide loading text once images are fetched
70
+ document.querySelector('.loading').style.display = 'none';
71
+
72
+ // Display images in the gallery
73
+ const gallery = document.getElementById('gallery');
74
+ imageUrls.forEach(url => {
75
+ const imgElement = document.createElement('img');
76
+ imgElement.src = url;
77
+ imgElement.alt = 'Image from markdown';
78
+ gallery.appendChild(imgElement);
79
+ });
80
+ })
81
+ .catch(error => {
82
+ console.error("Error fetching markdown:", error);
83
+ document.querySelector('.loading').textContent = "Failed to load images.";
84
+ });
85
+
86
+ // Function to extract image URLs from markdown content
87
+ function parseImageUrls(markdown) {
88
+ const regex = /!\[.*?\]\((https?:\/\/[^\s]+)\)/g;
89
+ let match;
90
+ const urls = [];
91
+ while ((match = regex.exec(markdown)) !== null) {
92
+ urls.push(match[1]);
93
+ }
94
+ return urls;
95
+ }
96
+ </script>
97
+
98
+ </body>
99
  </html>