Spaces:
Runtime error
Runtime error
Update app.py
Browse files- temperature change
- textual changes
- image style changes
app.py
CHANGED
@@ -34,7 +34,7 @@ from PIL import Image
|
|
34 |
import os
|
35 |
|
36 |
# Array with song cover art styles
|
37 |
-
image_input_styles = ["Random", "
|
38 |
|
39 |
# Get image type for image input
|
40 |
"""
|
@@ -49,7 +49,7 @@ def get_image_input(title, given_input_style):
|
|
49 |
final_style = image_input_styles_new[random_choice]
|
50 |
else:
|
51 |
final_style = given_input_style
|
52 |
-
image_input = 'Cover for ' + title + ' in style of ' + final_style
|
53 |
return image_input, final_style
|
54 |
|
55 |
# Available models for generate lyrics pipeline
|
@@ -101,9 +101,9 @@ def generate_beatles(input_prompt, temperature, top_p, given_input_style):
|
|
101 |
return (title, generated_lyrics, image, image_style)
|
102 |
|
103 |
# Create textboxes for input and output
|
104 |
-
input_box = gr.Textbox(label="Write the start of a song here", placeholder="Write the start of a song here", value="Looking beyond the Broad Horizon", lines=2, max_lines=5)
|
105 |
-
gen_lyrics = gr.Textbox(label="
|
106 |
-
gen_title = gr.Textbox(label="Proposed
|
107 |
gen_image = gr.Gallery(label="Proposed song cover").style(grid=1, height="auto")
|
108 |
gen_image_style = gr.Textbox(label="Image style", lines=1)
|
109 |
|
@@ -129,9 +129,9 @@ css = """
|
|
129 |
"""
|
130 |
|
131 |
# Let users select their own temperature and top-p
|
132 |
-
temperature = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, label="Change the temperature \r\n (higher temperature = more creative in lyrics generation, but posibbly less Beatly)", value=0.
|
133 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, label="Change top probability of the next word \n (higher top probability = more words to choose from for the next word, but possibly less Beatly)", value=0.5, show_label=True)
|
134 |
-
given_input_style = gr.Dropdown(choices=image_input_styles, value="Random", label="Choose the art style for the
|
135 |
#checkpoint = gr.Radio(checkpoint_choices, value='wvangils/GPT-Medium-Beatles-Lyrics-finetuned-newlyrics', interactive=True, label = 'Select fine-tuned model', show_label=True)
|
136 |
|
137 |
# Use generate Beatles function in demo-app Gradio
|
|
|
34 |
import os
|
35 |
|
36 |
# Array with song cover art styles
|
37 |
+
image_input_styles = ["Random", "Pencil sketch", "Oil painting", "Pop art", "Piet Mondriaan"]
|
38 |
|
39 |
# Get image type for image input
|
40 |
"""
|
|
|
49 |
final_style = image_input_styles_new[random_choice]
|
50 |
else:
|
51 |
final_style = given_input_style
|
52 |
+
image_input = 'Cover for ' + title.lower() + ' in style of ' + final_style
|
53 |
return image_input, final_style
|
54 |
|
55 |
# Available models for generate lyrics pipeline
|
|
|
101 |
return (title, generated_lyrics, image, image_style)
|
102 |
|
103 |
# Create textboxes for input and output
|
104 |
+
input_box = gr.Textbox(label="Write the start of a song here", placeholder="Write the start of a new song here", value="Looking beyond the Broad Horizon", lines=2, max_lines=5)
|
105 |
+
gen_lyrics = gr.Textbox(label="Proposed song lyrics", lines=15)
|
106 |
+
gen_title = gr.Textbox(label="Proposed song title", lines=1)
|
107 |
gen_image = gr.Gallery(label="Proposed song cover").style(grid=1, height="auto")
|
108 |
gen_image_style = gr.Textbox(label="Image style", lines=1)
|
109 |
|
|
|
129 |
"""
|
130 |
|
131 |
# Let users select their own temperature and top-p
|
132 |
+
temperature = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, label="Change the temperature \r\n (higher temperature = more creative in lyrics generation, but posibbly less Beatly)", value=0.7, show_label=True) #high = sensitive for low probability tokens
|
133 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, label="Change top probability of the next word \n (higher top probability = more words to choose from for the next word, but possibly less Beatly)", value=0.5, show_label=True)
|
134 |
+
given_input_style = gr.Dropdown(choices=image_input_styles, value="Random", label="Choose the art style for the song cover", show_label=True)
|
135 |
#checkpoint = gr.Radio(checkpoint_choices, value='wvangils/GPT-Medium-Beatles-Lyrics-finetuned-newlyrics', interactive=True, label = 'Select fine-tuned model', show_label=True)
|
136 |
|
137 |
# Use generate Beatles function in demo-app Gradio
|