Update app.py
Browse files
app.py
CHANGED
@@ -50,20 +50,21 @@ def generate(prompt):
|
|
50 |
return res
|
51 |
|
52 |
def generate_story(prompt):
|
|
|
53 |
story = generate(prompt=prompt)
|
54 |
summary = summarizer(story, min_length=5, max_length=15)[0]['summary_text'].split('.')[0]
|
55 |
return story, summary, gr.update(visible=True)
|
56 |
|
57 |
def on_change_event(app_state):
|
58 |
-
|
59 |
if app_state and app_state['running'] and app_state['img']:
|
60 |
img = app_state['img']
|
61 |
step = app_state['step']
|
62 |
-
|
63 |
app_state['dots'] += 1
|
64 |
app_state['dots'] = app_state['dots'] % 10
|
65 |
message = app_state['status_msg'] + ' *' * app_state['dots']
|
66 |
-
|
67 |
return gr.update(value=app_state['img_list'], label='intermediate steps'), gr.update(value=message)
|
68 |
else:
|
69 |
return gr.update(label='images list'), gr.update(value='')
|
|
|
50 |
return res
|
51 |
|
52 |
def generate_story(prompt):
|
53 |
+
print(f'Prompt={prompt}')
|
54 |
story = generate(prompt=prompt)
|
55 |
summary = summarizer(story, min_length=5, max_length=15)[0]['summary_text'].split('.')[0]
|
56 |
return story, summary, gr.update(visible=True)
|
57 |
|
58 |
def on_change_event(app_state):
|
59 |
+
# print(f'on_change_event {app_state}')
|
60 |
if app_state and app_state['running'] and app_state['img']:
|
61 |
img = app_state['img']
|
62 |
step = app_state['step']
|
63 |
+
# print(f'Updating the image:! {app_state}')
|
64 |
app_state['dots'] += 1
|
65 |
app_state['dots'] = app_state['dots'] % 10
|
66 |
message = app_state['status_msg'] + ' *' * app_state['dots']
|
67 |
+
# print (f'message={message}')
|
68 |
return gr.update(value=app_state['img_list'], label='intermediate steps'), gr.update(value=message)
|
69 |
else:
|
70 |
return gr.update(label='images list'), gr.update(value='')
|