Update app.py
Browse files
app.py
CHANGED
@@ -105,7 +105,7 @@ def infer_and_log(text_input):
|
|
105 |
print(f"Error uploading log: {e}")
|
106 |
tokens = text_input.split()
|
107 |
|
108 |
-
formatted_output = " ".join(f'<span style=
|
109 |
return formatted_output, word_probs
|
110 |
|
111 |
def clear_fields():
|
@@ -118,7 +118,7 @@ with gr.Blocks() as app:
|
|
118 |
input_box = gr.Textbox(label="Input Text", lines=10)
|
119 |
with gr.Row():
|
120 |
output_html = gr.HTML(label="Color-Coded Output")
|
121 |
-
output_json = gr.JSON(label="Word Probabilities")
|
122 |
with gr.Row():
|
123 |
submit_btn = gr.Button("Submit")
|
124 |
clear_btn = gr.Button("Clear")
|
|
|
105 |
print(f"Error uploading log: {e}")
|
106 |
tokens = text_input.split()
|
107 |
|
108 |
+
formatted_output = " ".join(f'<span style= color:{color}">{token}</span>' for token, color in zip(tokens, word_colors))
|
109 |
return formatted_output, word_probs
|
110 |
|
111 |
def clear_fields():
|
|
|
118 |
input_box = gr.Textbox(label="Input Text", lines=10)
|
119 |
with gr.Row():
|
120 |
output_html = gr.HTML(label="Color-Coded Output")
|
121 |
+
output_json = gr.JSON(label="Word Probabilities",visible=False)
|
122 |
with gr.Row():
|
123 |
submit_btn = gr.Button("Submit")
|
124 |
clear_btn = gr.Button("Clear")
|