movie-poster / app.py
Saiteja's picture
Update app.py
1ec4b68
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)