Update app.py
Browse files
app.py
CHANGED
|
@@ -111,7 +111,6 @@ json_output = gr.JSON()
|
|
| 111 |
css = '''
|
| 112 |
|
| 113 |
.bubble {
|
| 114 |
-
border: 2px solid #000;
|
| 115 |
border-radius: 10px;
|
| 116 |
padding: 10px;
|
| 117 |
margin-top: 15px;
|
|
@@ -223,6 +222,10 @@ with gr.Blocks(theme=gr.themes.Default(), css=css) as demo:
|
|
| 223 |
with gr.Group('Interpretation'):
|
| 224 |
interpretation_prompt = gr.Text(suggested_interpretation_prompts[0], label='Interpretation Prompt')
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
with gr.Accordion(open=False, label='Settings'):
|
| 227 |
with gr.Row():
|
| 228 |
num_tokens = gr.Slider(1, 100, step=1, value=20, label='Max. # of Tokens')
|
|
@@ -236,10 +239,7 @@ with gr.Blocks(theme=gr.themes.Default(), css=css) as demo:
|
|
| 236 |
top_k = gr.Slider(1, 1000, value=50, step=1, label='top k')
|
| 237 |
top_p = gr.Slider(0., 1., value=0.95, label='top p')
|
| 238 |
|
| 239 |
-
|
| 240 |
-
'even_bubble' if i % 2 == 0 else 'odd_bubble'])
|
| 241 |
-
for i in range(model.config.num_hidden_layers)]
|
| 242 |
-
|
| 243 |
for i, btn in enumerate(tokens_container):
|
| 244 |
btn.click(partial(run_interpretation, i=i), [global_state, interpretation_prompt,
|
| 245 |
num_tokens, do_sample, temperature,
|
|
|
|
| 111 |
css = '''
|
| 112 |
|
| 113 |
.bubble {
|
|
|
|
| 114 |
border-radius: 10px;
|
| 115 |
padding: 10px;
|
| 116 |
margin-top: 15px;
|
|
|
|
| 222 |
with gr.Group('Interpretation'):
|
| 223 |
interpretation_prompt = gr.Text(suggested_interpretation_prompts[0], label='Interpretation Prompt')
|
| 224 |
|
| 225 |
+
interpretation_bubbles = [gr.Textbox('', container=False, visible=False, elem_classes=['bubble',
|
| 226 |
+
'even_bubble' if i % 2 == 0 else 'odd_bubble'])
|
| 227 |
+
for i in range(model.config.num_hidden_layers)]
|
| 228 |
+
|
| 229 |
with gr.Accordion(open=False, label='Settings'):
|
| 230 |
with gr.Row():
|
| 231 |
num_tokens = gr.Slider(1, 100, step=1, value=20, label='Max. # of Tokens')
|
|
|
|
| 239 |
top_k = gr.Slider(1, 1000, value=50, step=1, label='top k')
|
| 240 |
top_p = gr.Slider(0., 1., value=0.95, label='top p')
|
| 241 |
|
| 242 |
+
# event listeners
|
|
|
|
|
|
|
|
|
|
| 243 |
for i, btn in enumerate(tokens_container):
|
| 244 |
btn.click(partial(run_interpretation, i=i), [global_state, interpretation_prompt,
|
| 245 |
num_tokens, do_sample, temperature,
|