Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -519,7 +519,8 @@ with gr.Blocks(css=STYLES) as demo:
|
|
| 519 |
with gr.Column(elem_classes=['group-border']):
|
| 520 |
gr.Markdown('### title')
|
| 521 |
title = gr.Textbox(random.choice(TITLE_PLACEHOLDERS), elem_classes=['no-label'])
|
| 522 |
-
|
|
|
|
| 523 |
with gr.Column(elem_classes=['group-border']):
|
| 524 |
with gr.Column():
|
| 525 |
gr.Markdown("For instant generation and concatenation, use `generate text` button. "
|
|
@@ -591,6 +592,20 @@ with gr.Blocks(css=STYLES) as demo:
|
|
| 591 |
|
| 592 |
progress_bar = gr.Textbox(elem_classes=['no-label'])
|
| 593 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 594 |
share_btn.click(
|
| 595 |
fn=share,
|
| 596 |
inputs=[title, editor, cover_art],
|
|
|
|
| 519 |
with gr.Column(elem_classes=['group-border']):
|
| 520 |
gr.Markdown('### title')
|
| 521 |
title = gr.Textbox(random.choice(TITLE_PLACEHOLDERS), elem_classes=['no-label'])
|
| 522 |
+
random_title_btn = gr.Button("get random title", elem_classes=['control-label-font', 'control-button'])
|
| 523 |
+
|
| 524 |
with gr.Column(elem_classes=['group-border']):
|
| 525 |
with gr.Column():
|
| 526 |
gr.Markdown("For instant generation and concatenation, use `generate text` button. "
|
|
|
|
| 592 |
|
| 593 |
progress_bar = gr.Textbox(elem_classes=['no-label'])
|
| 594 |
|
| 595 |
+
random_title_btn.click(
|
| 596 |
+
fn=None,
|
| 597 |
+
inputs=None,
|
| 598 |
+
outputs=[title],
|
| 599 |
+
_js="""
|
| 600 |
+
function get_random_title() {
|
| 601 |
+
let titles = ['Pokemon training story', 'The Sun of Shangri-La', 'Man In The Future', 'Friends', 'Cyborg Of A Beast', 'Man At The Graveyard', 'Vampire Of The Land'];
|
| 602 |
+
|
| 603 |
+
return titles[(Math.floor(Math.random() * titles.length))];
|
| 604 |
+
}
|
| 605 |
+
""""
|
| 606 |
+
)
|
| 607 |
+
|
| 608 |
+
|
| 609 |
share_btn.click(
|
| 610 |
fn=share,
|
| 611 |
inputs=[title, editor, cover_art],
|