my-llama / app.py
osanseviero's picture
Upload app.py with huggingface_hub
40bb0a7
raw
history blame
955 Bytes
from diffusers import DDPMPipeline
import torch
import PIL.Image
import gradio as gr
import random
import numpy as np
ddpm_pipeline = DDPMPipeline.from_pretrained("osanseviero/my-llama")
def predict(seed=42):
generator = torch.manual_seed(seed)
images = ddpm_pipeline(generator=generator)["sample"]
return images[0]
random_seed = random.randint(0, 2147483647)
gr.Interface(
predict,
inputs=[
gr.inputs.Slider(0, 2147483647, label='Seed', default=random_seed, step=1),
],
outputs=gr.Image(shape=[256,256], type="pil", elem_id="output_image"),
title="Generate llama with diffusers!",
description="This demo the <a href=\"https://huggingface.co/osanseviero/my-llama\">my-llama</a> model to generate llama <a href="https://huggingface.co/osanseviero">osanseviero</a> using the <a href="https://github.com/osanseviero/diffuse-it">Diffuse It! tool</a>. Inference might take around a minute.",
).launch(debug=True)