dar-tau commited on
Commit
4ece76d
·
verified ·
1 Parent(s): ab00aa7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -103,7 +103,23 @@ tokenizer = AutoTokenizer.from_pretrained(tokenizer_name, token=os.environ['hf_t
103
 
104
  # demo
105
  json_output = gr.JSON()
106
- with gr.Blocks(theme=gr.themes.Default()) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  global_state = gr.State([])
108
  with gr.Row():
109
  with gr.Column(scale=5):
@@ -146,7 +162,7 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
146
  tokens_container = []
147
  with gr.Row():
148
  for i in range(MAX_PROMPT_TOKENS):
149
- btn = gr.Button('', visible=False)
150
  btn.click(partial(run_interpretation, i=i), [global_state, interpretation_prompt, num_tokens, do_sample, temperature,
151
  top_k, top_p, repetition_penalty, length_penalty
152
  ], [json_output])
 
103
 
104
  # demo
105
  json_output = gr.JSON()
106
+ css = '''
107
+ .token_btn{
108
+ background: none;
109
+ border: none;
110
+ padding: 0;
111
+ font: inherit;
112
+ cursor: pointer;
113
+ color: blue; /* default text color */
114
+ font-weight: bold;
115
+ }
116
+
117
+ .token_btn:hover {
118
+ color: red;
119
+ }
120
+
121
+ '''
122
+ with gr.Blocks(theme=gr.themes.Default(), css=css) as demo:
123
  global_state = gr.State([])
124
  with gr.Row():
125
  with gr.Column(scale=5):
 
162
  tokens_container = []
163
  with gr.Row():
164
  for i in range(MAX_PROMPT_TOKENS):
165
+ btn = gr.Button('', visible=False, elem_classes=['token_btn'])
166
  btn.click(partial(run_interpretation, i=i), [global_state, interpretation_prompt, num_tokens, do_sample, temperature,
167
  top_k, top_p, repetition_penalty, length_penalty
168
  ], [json_output])