Spaces:
Running
Running
Download test-api.js from Luca448/APP-Backend: direct link, hf CLI and curl.
- Browser
- Download file 794 Bytes
-
https://huggingface.co/spaces/Luca448/APP-Backend/resolve/main/test-api.js
- Command line
-
hf download hf://spaces/Luca448/APP-Backend/test-api.js
-
curl -L -o test-api.js https://huggingface.co/spaces/Luca448/APP-Backend/resolve/main/test-api.js
794 Bytes
| import { gemini } from './src/ai/gemini.js'; | |
| import { db } from './src/db/database.js'; | |
| async function test() { | |
| try { | |
| const apiKey = db.getSetting('gemini_api_key'); | |
| const prompt = 'Test bild'; | |
| const url = `https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image:predict?key=${apiKey}`; | |
| const body = { | |
| instances: [{ prompt: prompt }], | |
| parameters: { sampleCount: 1 } | |
| }; | |
| const res = await fetch(url, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify(body) | |
| }); | |
| const text = await res.text(); | |
| console.log('Result length:', text.length); | |
| console.log('Result preview:', text.substring(0, 200)); | |
| } catch(e) { console.error('Error:', e); } | |
| } | |
| test(); | |