Spaces:
Running
Running
Update index.html
Browse files- index.html +53 -0
index.html
CHANGED
|
@@ -14,6 +14,59 @@
|
|
| 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>
|
|
|
|
| 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 |
+
|
| 18 |
+
<button id="clickme"> Stop </button>
|
| 19 |
</div>
|
| 20 |
+
|
| 21 |
+
<script type="module">
|
| 22 |
+
// Import the functions you need from the SDKs you need
|
| 23 |
+
import { initializeApp } from "https://www.gstatic.com/firebasejs/12.3.0/firebase-app.js";
|
| 24 |
+
import { getAnalytics } from "https://www.gstatic.com/firebasejs/12.3.0/firebase-analytics.js";
|
| 25 |
+
// TODO: Add SDKs for Firebase products that you want to use
|
| 26 |
+
// https://firebase.google.com/docs/web/setup#available-libraries
|
| 27 |
+
|
| 28 |
+
// Your web app's Firebase configuration
|
| 29 |
+
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
|
| 30 |
+
const firebaseConfig = {
|
| 31 |
+
apiKey: "AIzaSyB6EeMqhn5kvMEDYRzhtdokA9i0idKtUKo",
|
| 32 |
+
authDomain: "winternut-pay.firebaseapp.com",
|
| 33 |
+
projectId: "winternut-pay",
|
| 34 |
+
storageBucket: "winternut-pay.firebasestorage.app",
|
| 35 |
+
messagingSenderId: "564557307443",
|
| 36 |
+
appId: "1:564557307443:web:a1abf6b0db99ca79560d46",
|
| 37 |
+
measurementId: "G-K07BVBE7FW"
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
// Initialize Firebase
|
| 41 |
+
const app = initializeApp(firebaseConfig);
|
| 42 |
+
const analytics = getAnalytics(app);
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
// Initialize the Gemini Developer API backend service
|
| 47 |
+
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });
|
| 48 |
+
|
| 49 |
+
// Create a `LiveGenerativeModel` instance with the flash-live model (only model that supports the Live API)
|
| 50 |
+
const model = getLiveGenerativeModel(ai, {
|
| 51 |
+
model: "gemini-2.0-flash-live-preview-04-09",
|
| 52 |
+
// Configure the model to respond with audio
|
| 53 |
+
generationConfig: {
|
| 54 |
+
responseModalities: [ResponseModality.AUDIO],
|
| 55 |
+
},
|
| 56 |
+
});
|
| 57 |
+
|
| 58 |
+
const session = await model.connect();
|
| 59 |
+
|
| 60 |
+
// Start the audio conversation
|
| 61 |
+
const audioConversationController = await startAudioConversation(session);
|
| 62 |
+
|
| 63 |
+
// ... Later, to stop the audio conversation
|
| 64 |
+
// await audioConversationController.stop()
|
| 65 |
+
document.getElementById("clickme").onclick( async ()=> {
|
| 66 |
+
await audioConversationController.stop()
|
| 67 |
+
})
|
| 68 |
+
</script>
|
| 69 |
+
|
| 70 |
+
|
| 71 |
</body>
|
| 72 |
</html>
|