lollms-webui/endpoints/docs/lollms_tti/DOC.md
Saifeddine ALOUI 1f5484f010
Update DOC.md
2024-09-27 11:07:45 +02:00

1.0 KiB

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();// You can also add a parameter BaseUrl which is by default "http://localhost:9600"
    
  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
      });
    
  5. To change the server base url, we can use:

    ttiClient.setBaseUrl("http://localhost:9600"); // Change to the right server address
    

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