image-demo / app.py
multimodalart's picture
multimodalart HF Staff
Upload app.py with huggingface_hub
ab8d6bb verified
Raw
History Blame Contribute Delete
505 Bytes
import numpy as np
import gradio as gr
# Pre-loaded image: a simple RGB gradient so the component shows content on load.
h, w = 256, 256
gradient = np.zeros((h, w, 3), dtype=np.uint8)
gradient[:, :, 0] = np.linspace(0, 255, w, dtype=np.uint8)[None, :]
gradient[:, :, 1] = np.linspace(0, 255, h, dtype=np.uint8)[:, None]
gradient[:, :, 2] = 128
with gr.Blocks() as demo:
gr.Markdown("# Image demo")
gr.Image(value=gradient, label="Pre-loaded image")
if __name__ == "__main__":
demo.launch()