analitics

Pages

Showing posts with label gradio. Show all posts
Showing posts with label gradio. Show all posts

Thursday, January 9, 2025

Python 3.10.12 : Simple test with diffusers to create texture.

Today I tested on colab a simple python script to generate a texture using: diffusers, torch and gradio.
I upload the notebook on my colab repo from GitHub.
The script is simple and works good:
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch

model_id = "dream-textures/texture-diffusion"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")

def generate_image(prompt):
    image = pipe(prompt).images[0]
    image.save("result.png")
    return image

iface = gr.Interface(
    fn=generate_image,
    inputs="text",
    outputs="image",
    title="Stable Diffusion Image Generator",
    description="Introduceți un prompt pentru a genera o imagine folosind Stable Diffusion."
)

iface.launch()
The result for the pbr winter terrain is this image:

Tuesday, January 7, 2025

Python 3.10.12 : Simple tests with gradio python package.

This is a simple example with gradio python package on colab notebook.
I test some basic UI graphics interface edit text , selection , slider and upload feature for some files : image, audio, video, any file.
You can find more on my Github - colab notebook repo.