Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,7 +74,8 @@ def infer(prompt,
|
|
| 74 |
greedy_decoding = False,
|
| 75 |
return_full_text = False):
|
| 76 |
|
| 77 |
-
|
|
|
|
| 78 |
top_k = None if top_k == 0 else top_k
|
| 79 |
do_sample = False if num_beams > 0 else not greedy_decoding
|
| 80 |
num_beams = None if (greedy_decoding or num_beams == 0) else num_beams
|
|
@@ -148,7 +149,7 @@ def getadvertisement(topic):
|
|
| 148 |
else:
|
| 149 |
input_keyword=getadline(random.choice('abcdefghijklmnopqrstuvwxyz'))
|
| 150 |
if 'Unsafe content found' in input_keyword:
|
| 151 |
-
input_keyword='
|
| 152 |
prompt_SD=input_keyword+','+prompt_image
|
| 153 |
# generate image
|
| 154 |
image = generate_image(prompt_SD)
|
|
@@ -164,10 +165,12 @@ with gr.Blocks() as demo:
|
|
| 164 |
gr.Markdown(
|
| 165 |
"""Enter a prompt and get the tee shirt design. Use examples as a guide. We use an equally powerful AI model bigscience/bloom."""
|
| 166 |
)
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
|
|
|
|
|
|
| 171 |
|
| 172 |
|
| 173 |
btn.click(getadvertisement,inputs=[textbox], outputs=[output_image])
|
|
|
|
| 74 |
greedy_decoding = False,
|
| 75 |
return_full_text = False):
|
| 76 |
|
| 77 |
+
print('Empty input')
|
| 78 |
+
print(prompt)
|
| 79 |
top_k = None if top_k == 0 else top_k
|
| 80 |
do_sample = False if num_beams > 0 else not greedy_decoding
|
| 81 |
num_beams = None if (greedy_decoding or num_beams == 0) else num_beams
|
|
|
|
| 149 |
else:
|
| 150 |
input_keyword=getadline(random.choice('abcdefghijklmnopqrstuvwxyz'))
|
| 151 |
if 'Unsafe content found' in input_keyword:
|
| 152 |
+
input_keyword='Abstract art with a splash of colors'
|
| 153 |
prompt_SD=input_keyword+','+prompt_image
|
| 154 |
# generate image
|
| 155 |
image = generate_image(prompt_SD)
|
|
|
|
| 165 |
gr.Markdown(
|
| 166 |
"""Enter a prompt and get the tee shirt design. Use examples as a guide. We use an equally powerful AI model bigscience/bloom."""
|
| 167 |
)
|
| 168 |
+
with gr.Row() as row:
|
| 169 |
+
with gr.Column():
|
| 170 |
+
textbox = gr.Textbox(placeholder="Enter prompt...", lines=1,label='Your prompt')
|
| 171 |
+
btn = gr.Button("Generate")
|
| 172 |
+
with gr.Column():
|
| 173 |
+
output_image = gr.components.Image(label="Your tee shirt")
|
| 174 |
|
| 175 |
|
| 176 |
btn.click(getadvertisement,inputs=[textbox], outputs=[output_image])
|