Update app.py
Browse files
app.py
CHANGED
|
@@ -36,8 +36,6 @@ summarizer = pipeline("summarization")
|
|
| 36 |
|
| 37 |
#######################################################
|
| 38 |
|
| 39 |
-
#######################################################
|
| 40 |
-
|
| 41 |
def break_until_dot(txt):
|
| 42 |
return txt.rsplit('.', 1)[0] + '.'
|
| 43 |
|
|
@@ -68,11 +66,10 @@ def on_change_event(app_state):
|
|
| 68 |
if app_state and app_state['running'] and app_state['img']:
|
| 69 |
img = app_state['img']
|
| 70 |
step = app_state['step']
|
| 71 |
-
label = f'Reconstructed image from the latent state at step {step+1}. It will get better :)'
|
| 72 |
print(f'Updating the image:! {app_state}')
|
| 73 |
app_state['dots'] += 1
|
| 74 |
app_state['dots'] = app_state['dots'] % 10
|
| 75 |
-
message = app_state['status_msg'] + '
|
| 76 |
print (f'message={message}')
|
| 77 |
return gr.update(value=app_state['img_list'], label='intermediate steps'), gr.update(value=message)
|
| 78 |
else:
|
|
@@ -94,7 +91,7 @@ with gr.Blocks() as demo:
|
|
| 94 |
app_state['img'] = res
|
| 95 |
app_state['step'] = step
|
| 96 |
app_state['img_list'].append(res)
|
| 97 |
-
app_state['status_msg'] = f'Generating step {step +
|
| 98 |
|
| 99 |
prompt = prompt + ' masterpiece charcoal pencil art lord of the rings illustration'
|
| 100 |
img = pipe(prompt, height=512, width=512, num_inference_steps=inference_steps, callback=callback, callback_steps=1)
|
|
|
|
| 36 |
|
| 37 |
#######################################################
|
| 38 |
|
|
|
|
|
|
|
| 39 |
def break_until_dot(txt):
|
| 40 |
return txt.rsplit('.', 1)[0] + '.'
|
| 41 |
|
|
|
|
| 66 |
if app_state and app_state['running'] and app_state['img']:
|
| 67 |
img = app_state['img']
|
| 68 |
step = app_state['step']
|
|
|
|
| 69 |
print(f'Updating the image:! {app_state}')
|
| 70 |
app_state['dots'] += 1
|
| 71 |
app_state['dots'] = app_state['dots'] % 10
|
| 72 |
+
message = app_state['status_msg'] + ' *' * app_state['dots']
|
| 73 |
print (f'message={message}')
|
| 74 |
return gr.update(value=app_state['img_list'], label='intermediate steps'), gr.update(value=message)
|
| 75 |
else:
|
|
|
|
| 91 |
app_state['img'] = res
|
| 92 |
app_state['step'] = step
|
| 93 |
app_state['img_list'].append(res)
|
| 94 |
+
app_state['status_msg'] = f'Generating step ({step + 1})'
|
| 95 |
|
| 96 |
prompt = prompt + ' masterpiece charcoal pencil art lord of the rings illustration'
|
| 97 |
img = pipe(prompt, height=512, width=512, num_inference_steps=inference_steps, callback=callback, callback_steps=1)
|