yassinovich commited on
Commit
7913bfb
·
verified ·
1 Parent(s): a0dcf47

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +152 -18
index.html CHANGED
@@ -1,19 +1,153 @@
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>Your App Name</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
17
+ min-height: 100vh;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ padding: 20px;
22
+ }
23
+
24
+ .container {
25
+ background: white;
26
+ border-radius: 20px;
27
+ padding: 40px;
28
+ max-width: 600px;
29
+ width: 100%;
30
+ box-shadow: 0 20px 60px rgba(0,0,0,0.3);
31
+ }
32
+
33
+ h1 {
34
+ color: #333;
35
+ margin-bottom: 10px;
36
+ }
37
+
38
+ p {
39
+ color: #666;
40
+ margin-bottom: 30px;
41
+ }
42
+
43
+ input {
44
+ width: 100%;
45
+ padding: 15px;
46
+ border: 2px solid #e0e0e0;
47
+ border-radius: 10px;
48
+ font-size: 16px;
49
+ margin-bottom: 20px;
50
+ }
51
+
52
+ button {
53
+ width: 100%;
54
+ padding: 15px;
55
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
56
+ color: white;
57
+ border: none;
58
+ border-radius: 10px;
59
+ font-size: 16px;
60
+ font-weight: 600;
61
+ cursor: pointer;
62
+ transition: transform 0.2s;
63
+ }
64
+
65
+ button:hover {
66
+ transform: translateY(-2px);
67
+ }
68
+
69
+ button:disabled {
70
+ opacity: 0.6;
71
+ cursor: not-allowed;
72
+ }
73
+
74
+ #result {
75
+ margin-top: 30px;
76
+ padding: 20px;
77
+ background: #f5f5f5;
78
+ border-radius: 10px;
79
+ display: none;
80
+ }
81
+
82
+ #result img {
83
+ width: 100%;
84
+ border-radius: 10px;
85
+ margin-top: 10px;
86
+ }
87
+ </style>
88
+ </head>
89
+ <body>
90
+ <div class="container">
91
+ <h1>🎨 YSOAI IMAGE GENERATOR</h1>
92
+ <p>With YSOAI, Generate Image Fast</p>
93
+
94
+ <input
95
+ type="text"
96
+ id="prompt"
97
+ placeholder="Enter your prompt..."
98
+ value="a cool cat wearing sunglasses"
99
+ >
100
+
101
+ <button onclick="generate()">Generate</button>
102
+
103
+ <div id="result">
104
+ <h3>Result:</h3>
105
+ <img id="image" alt="Generated image">
106
+ </div>
107
+ </div>
108
+
109
+ <script>
110
+ async function generate() {
111
+ const prompt = document.getElementById('prompt').value;
112
+ const button = document.querySelector('button');
113
+ const result = document.getElementById('result');
114
+ const img = document.getElementById('image');
115
+
116
+ // Disable button while generating
117
+ button.disabled = true;
118
+ button.textContent = 'Generating...';
119
+
120
+ try {
121
+ // Example: Generate image with Pollinations
122
+ const imageUrl = `https://image.pollinations.ai/prompt/${encodeURIComponent(prompt)}`;
123
+
124
+ img.src = imageUrl;
125
+ result.style.display = 'block';
126
+
127
+ // Example: Generate text with Pollinations
128
+ // const response = await fetch('https://text.pollinations.ai/openai', {
129
+ // method: 'POST',
130
+ // headers: { 'Content-Type': 'application/json' },
131
+ // body: JSON.stringify({
132
+ // messages: [{ role: 'user', content: prompt }],
133
+ // model: 'openai'
134
+ // })
135
+ // });
136
+ // const data = await response.json();
137
+ // console.log(data.choices[0].message.content);
138
+
139
+ } catch (error) {
140
+ alert('Error: ' + error.message);
141
+ } finally {
142
+ button.disabled = false;
143
+ button.textContent = 'Generate';
144
+ }
145
+ }
146
+
147
+ // Allow Enter key to submit
148
+ document.getElementById('prompt').addEventListener('keypress', (e) => {
149
+ if (e.key === 'Enter') generate();
150
+ });
151
+ </script>
152
+ </body>
153
  </html>