Tonic commited on
Commit
239d4fc
·
verified ·
1 Parent(s): 3a49793

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -7
app.py CHANGED
@@ -99,27 +99,22 @@ with gr.Blocks(theme=gr.themes.Base()) as iface:
99
 
100
  prompt = gr.Textbox(label="Add a passage in the style of historical texts", placeholder="Hi there my name is Tonic and I ride my bicycle along the river Seine:", lines=3)
101
 
102
- # Sliders for model parameters
103
  max_new_tokens = gr.Slider(label="Max New Tokens", minimum=50, maximum=1000, step=10, value=140)
104
  top_k = gr.Slider(label="Top-k Sampling", minimum=1, maximum=100, step=0.05, value=50)
105
  temperature = gr.Slider(label="Temperature", minimum=0.1, maximum=1.5, step=0.05, value=0.3)
106
  top_p = gr.Slider(label="Top-p (Nucleus Sampling)", minimum=0.1, maximum=1.0, step=0.005, value=0.95)
107
  repetition_penalty = gr.Slider(label="Repetition Penalty", minimum=0.5, maximum=2.0, step=0.05, value=1.0)
108
 
109
- # Output components
110
  generated_text_output = gr.Textbox(label="🎅🏻⌚OCRonos-Vintage")
111
  highlighted_text = gr.HighlightedText(label="🎅🏻⌚Tokenized", combine_adjacent=True, show_legend=True)
112
  tokenizer_info = gr.JSON(label="📉Tokenizer Info (Input Text)")
113
  dependency_parse_input = gr.HTML(label="👁️Visualization")
114
 
115
- # Hidden button and final output for dependency parse visualization
116
- send_button = gr.Button(value="👁️Visualize Generated Text", visible=False)
117
  dependency_parse_generated = gr.HTML(label="👁️Visualization (Generated Text)")
118
 
119
- # Reset button, hidden initially
120
  reset_button = gr.Button(value="♻️Start Again", visible=False)
121
 
122
- # Main interface logic: when clicked, "Generate" button hides itself and shows the reset button
123
  generate_button = gr.Button(value="🎅🏻⌚Generate Historical Text")
124
  generate_button.click(
125
  full_interface,
@@ -127,7 +122,6 @@ with gr.Blocks(theme=gr.themes.Base()) as iface:
127
  outputs=[generated_text_output, highlighted_text, tokenizer_info, dependency_parse_input, send_button, dependency_parse_generated, generate_button, reset_button]
128
  )
129
 
130
- # Reset button logic: hide itself and re-show the "Generate" button
131
  reset_button.click(
132
  reset_interface,
133
  inputs=None,
 
99
 
100
  prompt = gr.Textbox(label="Add a passage in the style of historical texts", placeholder="Hi there my name is Tonic and I ride my bicycle along the river Seine:", lines=3)
101
 
 
102
  max_new_tokens = gr.Slider(label="Max New Tokens", minimum=50, maximum=1000, step=10, value=140)
103
  top_k = gr.Slider(label="Top-k Sampling", minimum=1, maximum=100, step=0.05, value=50)
104
  temperature = gr.Slider(label="Temperature", minimum=0.1, maximum=1.5, step=0.05, value=0.3)
105
  top_p = gr.Slider(label="Top-p (Nucleus Sampling)", minimum=0.1, maximum=1.0, step=0.005, value=0.95)
106
  repetition_penalty = gr.Slider(label="Repetition Penalty", minimum=0.5, maximum=2.0, step=0.05, value=1.0)
107
 
 
108
  generated_text_output = gr.Textbox(label="🎅🏻⌚OCRonos-Vintage")
109
  highlighted_text = gr.HighlightedText(label="🎅🏻⌚Tokenized", combine_adjacent=True, show_legend=True)
110
  tokenizer_info = gr.JSON(label="📉Tokenizer Info (Input Text)")
111
  dependency_parse_input = gr.HTML(label="👁️Visualization")
112
 
113
+ send_button = gr.Button(generate_dependency_parse , value="👁️Visualize Generated Text", visible=False , inputs=[dependency_parse_generated] , outputs=[dependency_parse_generated]))
 
114
  dependency_parse_generated = gr.HTML(label="👁️Visualization (Generated Text)")
115
 
 
116
  reset_button = gr.Button(value="♻️Start Again", visible=False)
117
 
 
118
  generate_button = gr.Button(value="🎅🏻⌚Generate Historical Text")
119
  generate_button.click(
120
  full_interface,
 
122
  outputs=[generated_text_output, highlighted_text, tokenizer_info, dependency_parse_input, send_button, dependency_parse_generated, generate_button, reset_button]
123
  )
124
 
 
125
  reset_button.click(
126
  reset_interface,
127
  inputs=None,