Update app.py
Browse files
app.py
CHANGED
@@ -129,7 +129,10 @@ def run_interpretation(raw_original_prompt, raw_interpretation_prompt, max_new_t
|
|
129 |
**generation_kwargs)
|
130 |
generation_texts = tokenizer.batch_decode(generated)
|
131 |
progress_dummy_output = ''
|
132 |
-
|
|
|
|
|
|
|
133 |
bubble_outputs += [gr.Textbox('', visible=False) for _ in range(MAX_NUM_LAYERS - len(bubble_outputs))]
|
134 |
return [progress_dummy_output, *bubble_outputs]
|
135 |
|
@@ -220,9 +223,8 @@ with gr.Blocks(theme=gr.themes.Default(), css='styles.css') as demo:
|
|
220 |
btn.render()
|
221 |
|
222 |
progress_dummy = gr.Markdown('', elem_id='progress_dummy')
|
223 |
-
interpretation_bubbles = [gr.Textbox('', show_label=True, label=f'Layer {i}', container=False, visible=False
|
224 |
-
|
225 |
-
) for i in range(MAX_NUM_LAYERS)]
|
226 |
|
227 |
# event listeners
|
228 |
for i, btn in enumerate(tokens_container):
|
|
|
129 |
**generation_kwargs)
|
130 |
generation_texts = tokenizer.batch_decode(generated)
|
131 |
progress_dummy_output = ''
|
132 |
+
elem_classes = [['bubble', 'even_bubble' if i % 2 == 0 else 'odd_bubble'] + (['faded'] if True else []) for i in range(len(generation_texts))]
|
133 |
+
bubble_outputs = [gr.Textbox(text.replace('\n', ' '), show_label=True, visible=True,
|
134 |
+
container=False, label=f'Layer {i}', elem_classes=elem_classes[i])
|
135 |
+
for text in generation_texts]
|
136 |
bubble_outputs += [gr.Textbox('', visible=False) for _ in range(MAX_NUM_LAYERS - len(bubble_outputs))]
|
137 |
return [progress_dummy_output, *bubble_outputs]
|
138 |
|
|
|
223 |
btn.render()
|
224 |
|
225 |
progress_dummy = gr.Markdown('', elem_id='progress_dummy')
|
226 |
+
interpretation_bubbles = [gr.Textbox('', show_label=True, label=f'Layer {i}', container=False, visible=False)
|
227 |
+
for i in range(MAX_NUM_LAYERS)]
|
|
|
228 |
|
229 |
# event listeners
|
230 |
for i, btn in enumerate(tokens_container):
|