Bharatgas Image Generator

import React, { useState, useEffect } from 'react'; const App = () => { const [imageUrl, setImageUrl] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); // The prompt incorporates the user's permanent face and aspect ratio instructions. const prompt = "A high-quality realistic 19:6 portrait of the person with the saved face reference, acting as a professional mentor in a modern Indian kitchen with a Bharatgas LPG cylinder, holding official gas passbook and legal transfer documents, natural lighting, clear background, cinematic style, no text."; const generateImage = async () => { setLoading(true); setError(null); const apiKey = ""; // The execution environment provides the key automatically try { const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/imagen-4.0-generate-001:predict?key=${apiKey}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ instances: { prompt: prompt }, parameters: { sampleCount: 1, aspectRatio: "9:16" // Closest standard to the custom request if exact logic is abstracted } }), }); if (!response.ok) { throw new Error('เค‡เคฎेเคœ เคœเคจเคฐेเคŸ เค•เคฐเคฃ्เคฏाเคค เค…เคกเคšเคฃ เค†เคฒी. เค•ृเคชเคฏा เคชुเคจ्เคนा เคช्เคฐเคฏเคค्เคจ เค•เคฐा.'); } const result = await response.json(); if (result.predictions && result.predictions[0].bytesBase64Encoded) { const base64 = result.predictions[0].bytesBase64Encoded; setImageUrl(`data:image/png;base64,${base64}`); } else { throw new Error('เคกेเคŸा เคช्เคฐाเคช्เคค เคाเคฒा เคจाเคนी.'); } } catch (err) { setError(err.message); } finally { setLoading(false); } }; return (

Bharatgas เค‡เคฎेเคœ เคœเคจเคฐेเคŸเคฐ

เฅงเฅฏ:เฅฌ เคชोเคฐ्เคŸ्เคฐेเคŸ เค†เคฃि เคธेเคต्เคน เค•ेเคฒेเคฒा เคšेเคนเคฐा เคตाเคชเคฐूเคจ เคซिเคšเคฐ्เคก เค‡เคฎेเคœ เคคเคฏाเคฐ เค•เคฐा.

{!imageUrl && !loading && ( )} {loading && (

เคคुเคฎเคšी เคช्เคฐोเคซेเคถเคจเคฒ เค‡เคฎेเคœ เคคเคฏाเคฐ เคนोเคค เค†เคนे...

)} {error && (
{error}
)} {imageUrl && (
Generated Portrait
เคกाเคŠเคจเคฒोเคก เค•เคฐा
)}
); }; export default App;