Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ def generate_dependency_parse(generated_text):
|
|
73 |
return html_generated
|
74 |
|
75 |
def display_dependency_parse(generated_text):
|
76 |
-
return generate_dependency_parse(generated_text)
|
77 |
|
78 |
def full_interface(prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty):
|
79 |
generated_highlight, generated_text = historical_generation(
|
@@ -81,7 +81,8 @@ def full_interface(prompt, max_new_tokens, top_k, temperature, top_p, repetition
|
|
81 |
)
|
82 |
|
83 |
tokens_input, pos_count_input, html_input = text_analysis(prompt)
|
84 |
-
|
|
|
85 |
|
86 |
def reset_interface():
|
87 |
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)
|
@@ -106,25 +107,24 @@ with gr.Blocks(theme=gr.themes.Base()) as iface:
|
|
106 |
highlighted_text = gr.HighlightedText(label="🎅🏻⌚Tokenized", combine_adjacent=True, show_legend=True)
|
107 |
tokenizer_info = gr.JSON(label="📉Tokenizer Info (Input Text)")
|
108 |
dependency_parse_input = gr.HTML(label="👁️Visualization")
|
109 |
-
|
110 |
-
send_button = gr.Button(value="🎅🏻⌚OCRonos-Vintage 👁️Visualization", visible=False)
|
111 |
dependency_parse_generated = gr.HTML(label="Dependency Parse Visualization (Generated Text)", visible=False)
|
112 |
|
113 |
-
send_button.
|
114 |
-
display_dependency_parse,
|
115 |
-
inputs=[generated_text_output],
|
116 |
-
outputs=[dependency_parse_generated]
|
117 |
-
)
|
118 |
-
|
119 |
reset_button = gr.Button(value="♻️Start Again", visible=False)
|
120 |
|
121 |
generate_button = gr.Button(value="🎅🏻⌚Generate Historical Text")
|
122 |
generate_button.click(
|
123 |
full_interface,
|
124 |
inputs=[prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty],
|
125 |
-
outputs=[generated_text_output, highlighted_text, tokenizer_info, dependency_parse_input, send_button,
|
126 |
)
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
reset_button.click(
|
129 |
reset_interface,
|
130 |
inputs=None,
|
|
|
73 |
return html_generated
|
74 |
|
75 |
def display_dependency_parse(generated_text):
|
76 |
+
return generate_dependency_parse(generated_text)
|
77 |
|
78 |
def full_interface(prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty):
|
79 |
generated_highlight, generated_text = historical_generation(
|
|
|
81 |
)
|
82 |
|
83 |
tokens_input, pos_count_input, html_input = text_analysis(prompt)
|
84 |
+
# Set the visibility of the generated text and highlight components
|
85 |
+
return generated_text, generated_highlight, pos_count_input, html_input, gr.update(visible=True), "", gr.update(visible=True), gr.update(visible=False)
|
86 |
|
87 |
def reset_interface():
|
88 |
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)
|
|
|
107 |
highlighted_text = gr.HighlightedText(label="🎅🏻⌚Tokenized", combine_adjacent=True, show_legend=True)
|
108 |
tokenizer_info = gr.JSON(label="📉Tokenizer Info (Input Text)")
|
109 |
dependency_parse_input = gr.HTML(label="👁️Visualization")
|
|
|
|
|
110 |
dependency_parse_generated = gr.HTML(label="Dependency Parse Visualization (Generated Text)", visible=False)
|
111 |
|
112 |
+
send_button = gr.Button(value="🎅🏻⌚OCRonos-Vintage 👁️Visualization", visible=False)
|
|
|
|
|
|
|
|
|
|
|
113 |
reset_button = gr.Button(value="♻️Start Again", visible=False)
|
114 |
|
115 |
generate_button = gr.Button(value="🎅🏻⌚Generate Historical Text")
|
116 |
generate_button.click(
|
117 |
full_interface,
|
118 |
inputs=[prompt, max_new_tokens, top_k, temperature, top_p, repetition_penalty],
|
119 |
+
outputs=[generated_text_output, highlighted_text, tokenizer_info, dependency_parse_input, send_button, dependency_parse_generated, generate_button, reset_button]
|
120 |
)
|
121 |
|
122 |
+
send_button.click(
|
123 |
+
display_dependency_parse,
|
124 |
+
inputs=[generated_text_output],
|
125 |
+
outputs=[dependency_parse_generated]
|
126 |
+
)
|
127 |
+
|
128 |
reset_button.click(
|
129 |
reset_interface,
|
130 |
inputs=None,
|