Tonic commited on
Commit
857ca0a
·
verified ·
1 Parent(s): f5eae85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -90,13 +90,21 @@ def display_dependency_parse(generated_text):
90
  return generate_dependency_parse(generated_text)
91
 
92
  def full_interface(prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty):
 
93
  generated_highlight, generated_text = historical_generation(
94
  prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty
95
  )
96
 
 
97
  tokens_input, pos_count_input, html_input = text_analysis(prompt)
 
 
 
 
98
  # Set the visibility of the generated text and highlight components
99
- return generated_text, generated_highlight, pos_count_input, html_input, gr.update(visible=True), "", gr.update(visible=True), gr.update(visible=False)
 
 
100
 
101
  def reset_interface():
102
  return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
@@ -109,7 +117,7 @@ with gr.Blocks(theme=gr.themes.Base()) as iface:
109
 
110
  max_new_tokens = gr.Slider(label="🎅🏻⌚Length", minimum=50, maximum=1000, step=5, value=320)
111
  top_k = gr.Slider(label="🎅🏻⌚Sampling", minimum=1, maximum=100, step=1, value=50)
112
- temperature = gr.Slider(label="🎅🏻⌚Creativity", minimum=0.1, maximum=1, step=0.05, value=0.7)
113
  top_p = gr.Slider(label="🎅🏻⌚Quality", minimum=0.1, maximum=0.99, step=0.01, value=0.97)
114
  repetition_penalty = gr.Slider(label="🎅🏻⌚Repetition Penalty", minimum=0.5, maximum=2.0, step=0.05, value=1.3)
115
 
 
90
  return generate_dependency_parse(generated_text)
91
 
92
  def full_interface(prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty):
93
+ # Generate historical-style text and tokenized output
94
  generated_highlight, generated_text = historical_generation(
95
  prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty
96
  )
97
 
98
+ # Analyze input text (dependency parse visualization)
99
  tokens_input, pos_count_input, html_input = text_analysis(prompt)
100
+
101
+ # Generate dependency parse for the generated text
102
+ dependency_parse_generated_html = generate_dependency_parse(generated_text)
103
+
104
  # Set the visibility of the generated text and highlight components
105
+ return (generated_text, generated_highlight, pos_count_input, html_input,
106
+ gr.update(visible=True), dependency_parse_generated_html,
107
+ gr.update(visible=True), gr.update(visible(False)))
108
 
109
  def reset_interface():
110
  return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
 
117
 
118
  max_new_tokens = gr.Slider(label="🎅🏻⌚Length", minimum=50, maximum=1000, step=5, value=320)
119
  top_k = gr.Slider(label="🎅🏻⌚Sampling", minimum=1, maximum=100, step=1, value=50)
120
+ temperature = gr.Slider(label="🎅🏻⌚Boringness", minimum=0.1, maximum=1, step=0.05, value=0.3)
121
  top_p = gr.Slider(label="🎅🏻⌚Quality", minimum=0.1, maximum=0.99, step=0.01, value=0.97)
122
  repetition_penalty = gr.Slider(label="🎅🏻⌚Repetition Penalty", minimum=0.5, maximum=2.0, step=0.05, value=1.3)
123