Spaces:
Running
Running
import gradio as gr | |
from utils import * | |
styles_mapping = { | |
"Illustration Style": '<illustration-style>', "Line Art":'<line-art>', | |
"Hitokomoru Style":'<hitokomoru-style-nao>', "Marc Allante": '<Marc_Allante>', | |
"Midjourney":'<midjourney-style>', "Hanfu Anime": '<hanfu-anime-style>', | |
"Birb Style": '<birb-style>' | |
} | |
with gr.Blocks() as interface: | |
#gr.HTML(value=HTML_TEMPLATE, show_label=False) | |
with gr.Row(): | |
text_input = gr.Textbox( | |
label="Enter your prompt", | |
placeholder="Cats fighting on the road.....", | |
) | |
concept_dropdown = gr.Dropdown( | |
label="Select a Concept", | |
choices=["Illustration Style", "Line Art", "Hitokomoru Style", "Marc Allante", "Midjourney", "Hanfu Anime", "Birb Style"], | |
value='Marc Allante' | |
) | |
method_dropdown = gr.Dropdown( | |
label="Select Guidance Type", | |
choices=["Edge", "Contrast", "Sharpness", "Blue", "Brightness"], | |
value='Contrast' | |
) | |
seed_slider = gr.Slider( | |
label="Random Seed", | |
minimum=0, | |
maximum=2000, | |
step=1, | |
value=42 | |
) | |
inputs = [text_input, concept_dropdown, method_dropdown, seed_slider] | |
with gr.Row(): | |
outputs = gr.Gallery( | |
label="Generative Images", show_label=True, | |
columns=[2], rows=[1], object_fit="contain" | |
) | |
with gr.Row(): | |
button = gr.Button("Generate Image") | |
button.click(show_image, inputs=inputs, outputs=outputs) | |
with gr.Row(): | |
gr.Examples(examples=get_examples(), inputs=inputs, outputs=outputs, fn=show_image, cache_examples=True) | |
if __name__ == "__main__": | |
interface.launch(enable_queue=True) |