Spaces:
Runtime error
Runtime error
File size: 1,237 Bytes
60069cd 1ec4b68 60069cd 1ec4b68 60069cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
# setting=heroic pose, wearing a sleek, high-tech suit and holding a futuristic gadget.The background should be dark and dramatic, with explosions and other action-packed elements
def generate(celebrity, movie,setting):
prompt=f" Create a movie poster featuring {celebrity} in a {movie} inspired role.The poster should include the title of the movie {movie},and feature {celebrity} in a {setting}"
image = pipe(prompt).images[0]
return image
import os
HF_TOKEN = os.getenv('sai')
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "movie-poster")
gr.Interface(
fn = generate,
inputs=[
gr.inputs.Textbox(label="celebrity"),
gr.inputs.Dropdown(label="Movies", choices=["Mission Impossible", "Avengers", "Batman","Baahubali","Transporter","Rocky"]),
gr.inputs.Textbox(label="Setting")
],
outputs= gr.outputs.Image(label="Generated movie poster",type='pil'),
title="Movie Poster Generator" ,
allow_flagging="manual",
flagging_options=["Good", "Better", "Worst"],
flagging_callback=hf_writer
).launch(share=True) |