Update index.html
Browse files- index.html +25 -22
index.html
CHANGED
|
@@ -150,7 +150,31 @@ module.exports = { lumin };</code></pre>
|
|
| 150 |
<h2>Example Usage</h2>
|
| 151 |
<p>Below are some examples of how to use the <code>lumin</code> function.</p>
|
| 152 |
<h3>Basic Usage</h3>
|
| 153 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
<div class="code-block">
|
| 155 |
<pre><code>const { lumin } = require('./lumin');
|
| 156 |
lumin("query")
|
|
@@ -209,26 +233,5 @@ lumin("query", "username", "logic", true)
|
|
| 209 |
}
|
| 210 |
fetchStats();
|
| 211 |
</script>
|
| 212 |
-
<audio id="myAudio" controls loop>
|
| 213 |
-
<source src="" type="audio/mpeg">
|
| 214 |
-
Your browser does not support the audio element.
|
| 215 |
-
</audio>
|
| 216 |
-
<script>
|
| 217 |
-
fetch('https://pomf2.lain.la/f/jcn759xf.mp3')
|
| 218 |
-
.then(response => {
|
| 219 |
-
if (!response.ok) {
|
| 220 |
-
throw new Error('Network response was not ok');
|
| 221 |
-
}
|
| 222 |
-
return response.blob();
|
| 223 |
-
})
|
| 224 |
-
.then(blob => {
|
| 225 |
-
const audioUrl = URL.createObjectURL(blob);
|
| 226 |
-
const myAudio = document.getElementById('myAudio');
|
| 227 |
-
myAudio.src = audioUrl; // Set src property instead of srcObject
|
| 228 |
-
})
|
| 229 |
-
.catch(error => {
|
| 230 |
-
console.error('There was a problem fetching the MP3 file:', error);
|
| 231 |
-
});
|
| 232 |
-
</script>
|
| 233 |
</body>
|
| 234 |
</html>
|
|
|
|
| 150 |
<h2>Example Usage</h2>
|
| 151 |
<p>Below are some examples of how to use the <code>lumin</code> function.</p>
|
| 152 |
<h3>Basic Usage</h3>
|
| 153 |
+
<p>• Send a query to the LuminAI API using GET:</p>
|
| 154 |
+
<div class="code-block">
|
| 155 |
+
<pre><code>const axios = require('axios');
|
| 156 |
+
|
| 157 |
+
function getLuminaiResponse(q) {
|
| 158 |
+
const url = `https://ilhamdev-luminai.hf.space/api/q=${encodeURIComponent(q)}`;
|
| 159 |
+
|
| 160 |
+
return axios.get(url)
|
| 161 |
+
.then(response => response.data)
|
| 162 |
+
.catch(error => {
|
| 163 |
+
console.error(`Error fetching data from ${url}:`, error);
|
| 164 |
+
throw error;
|
| 165 |
+
});
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
// Example usage:
|
| 169 |
+
getLuminaiResponse('example query')
|
| 170 |
+
.then(data => {
|
| 171 |
+
console.log('Data:', data);
|
| 172 |
+
})
|
| 173 |
+
.catch(error => {
|
| 174 |
+
console.error('Error:', error);
|
| 175 |
+
});</code></pre>
|
| 176 |
+
</div>
|
| 177 |
+
<p>• Send a query to the LuminAI API:</p>
|
| 178 |
<div class="code-block">
|
| 179 |
<pre><code>const { lumin } = require('./lumin');
|
| 180 |
lumin("query")
|
|
|
|
| 233 |
}
|
| 234 |
fetchStats();
|
| 235 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
</body>
|
| 237 |
</html>
|