Spaces:
Runtime error
Runtime error
def generate_art(character_dropdown, seed_slider): | |
if character_dropdown == "NONE": | |
return "NULL" | |
else: | |
return "NOT NULL" | |
return "Hello There!" | |
HTML_TEMPLATE = """ | |
<style> | |
#app-header { | |
text-align: center; | |
background: rgba(255, 255, 255, 0.8); /* Semi-transparent white */ | |
padding: 20px; | |
border-radius: 10px; | |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
position: relative; /* To position the artifacts */ | |
} | |
#app-header h1 { | |
color: #f308eb; | |
font-size: 2em; | |
margin-bottom: 10px; | |
} | |
.concept { | |
position: relative; | |
transition: transform 0.3s; | |
} | |
.concept:hover { | |
transform: scale(1.1); | |
} | |
.concept img { | |
width: 100px; | |
border-radius: 10px; | |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
} | |
.concept-description { | |
position: absolute; | |
bottom: -30px; | |
left: 50%; | |
transform: translateX(-50%); | |
background-color: #4CAF50; | |
color: white; | |
padding: 5px 10px; | |
border-radius: 5px; | |
opacity: 0; | |
transition: opacity 0.3s; | |
} | |
.concept:hover .concept-description { | |
opacity: 1; | |
} | |
/* Artifacts */ | |
</style> | |
<div id="app-header"> | |
<!-- Artifacts --> | |
<div class="artifact large"></div> | |
<div class="artifact medium"></div> | |
<div class="artifact small"></div> | |
<!-- Content --> | |
<h1>Shakespeare Dialogue Generator</h1> | |
<p>Generate new dialogue for Shakespearean character by selecting character from dropdown.</p> | |
<div style="display: flex; justify-content: center; gap: 20px; margin-top: 20px;"> | |
<div class="concept"> | |
<img src="https://github.com/Delve-ERAV1/S20/assets/11761529/30ac92f8-fc62-4aab-9221-043865c6fe7c" alt="Romeo"> | |
<div class="concept-description">Midjourney Style</div> | |
</div> | |
<div class="concept"> | |
<img src="https://github.com/Delve-ERAV1/S20/assets/11761529/54c9a61e-df9f-4054-835b-ec2c6ba5916c" alt="Juliet"> | |
<div class="concept-description">Dreams Style</div> | |
</div> | |
<div class="concept"> | |
<img src="https://github.com/Delve-ERAV1/S20/assets/11761529/2f37e402-15d1-4a74-ba85-bb1566da930e" alt="MacBeth"> | |
<div class="concept-description">Moebius Style</div> | |
</div> | |
<div class="concept"> | |
<img src="https://github.com/Delve-ERAV1/S20/assets/11761529/f838e767-ac20-4996-b5be-65c61b365ce0" alt="A"> | |
<div class="concept-description">Hong Kong born artist inspired by western and eastern influences</div> | |
</div> | |
<div class="concept"> | |
<img src="https://github.com/Delve-ERAV1/S20/assets/11761529/9958140a-1b62-4972-83ca-85b023e3863f" alt="S"> | |
<div class="concept-description">WLOP (Born 1987) is known for Digital Art (NFTs)</div> | |
</div> | |
</div> | |
</div> | |
""" | |
with gr.Blocks() as interface: | |
gr.HTML(value=HTML_TEMPLATE, show_label=False) | |
with gr.Row(): | |
character_dropdown = gr.Dropdown( | |
label="Select a Character", | |
choices=["NONE","ROMEO","OPHELIA","DESDEMONA","MACDUFF"], | |
value='Dream' | |
) | |
seed_slider = gr.Slider( | |
label="Random Seed", | |
minimum=0, | |
maximum=1000, | |
step=1, | |
value=42 | |
) | |
inputs = [character_dropdown, seed_slider] | |
with gr.Row(): | |
outputs = gr.Textbox( | |
label="Generated Dialogue" | |
) | |
with gr.Row(): | |
button = gr.Button("Generate Dialogue") | |
button.click(generate_art, inputs=inputs, outputs=outputs) | |
if __name__ == "__main__": | |
interface.launch(enable_queue=True) |