lollms-webui/endpoints/docs/lollms_tti/DOC.md
Saifeddine ALOUI e25c11f089 upgraded
2024-08-26 00:46:26 +02:00

817 B

Lollms Text to Image Library

  1. Include the library:

    <script src="/lollms_assets/js/lollms_tti"></script>
    
  2. Initialize in your JavaScript:

    const ttiClient = new LollmsTTI();
    
  3. Generate and display an image:

    const container = document.getElementById('image-container');
    await ttiClient.generateAndDisplayImage('prompt', 'negative prompt', 512, 512, container); // The container must be a div
    
  4. Or generate image separately:

    ttiClient.generateImage('prompt', 'negative prompt', 512, 512)// prompt, negative prompt, width, height
      .then(base64Image => {
        // Use base64Image
      });
    

This library simplifies image generation requests to the LoLLMs backend, handling the API call and image display.