Update app.py
Browse filesRemoved duplicate clear buttons from all three tabs
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import
|
3 |
|
4 |
-
# Load model and tokenizer
|
5 |
model = T5ForConditionalGeneration.from_pretrained("Addaci/mT5-small-experiment-13-checkpoint-2790")
|
6 |
tokenizer = T5Tokenizer.from_pretrained("Addaci/mT5-small-experiment-13-checkpoint-2790")
|
7 |
|
@@ -65,12 +65,12 @@ def clickable_buttons():
|
|
65 |
|
66 |
# Interface layout
|
67 |
with gr.Blocks() as demo:
|
68 |
-
gr.HTML("<h1>
|
69 |
gr.HTML(clickable_buttons())
|
70 |
|
71 |
with gr.Tab("Correct Raw HTR"):
|
72 |
-
input_text = gr.Textbox(lines=10, label="
|
73 |
-
output_text = gr.Textbox(label="
|
74 |
max_new_tokens = gr.Slider(10, 512, value=128, label="Max New Tokens")
|
75 |
temperature = gr.Slider(0.1, 1.0, value=0.7, label="Temperature")
|
76 |
correct_button = gr.Button("Correct HTR")
|
@@ -82,8 +82,8 @@ with gr.Blocks() as demo:
|
|
82 |
clear_button.click(fn=clear_all, outputs=[input_text, output_text])
|
83 |
|
84 |
with gr.Tab("Summarize Legal Text"):
|
85 |
-
input_text_summarize = gr.Textbox(lines=10, label="
|
86 |
-
output_text_summarize = gr.Textbox(label="
|
87 |
max_new_tokens_summarize = gr.Slider(10, 512, value=256, label="Max New Tokens")
|
88 |
temperature_summarize = gr.Slider(0.1, 1.0, value=0.5, label="Temperature")
|
89 |
summarize_button = gr.Button("Summarize Text")
|
@@ -95,9 +95,9 @@ with gr.Blocks() as demo:
|
|
95 |
clear_button_summarize.click(fn=clear_all, outputs=[input_text_summarize, output_text_summarize])
|
96 |
|
97 |
with gr.Tab("Answer Legal Question"):
|
98 |
-
input_text_question = gr.Textbox(lines=10, label="
|
99 |
-
question = gr.Textbox(label="
|
100 |
-
output_text_question = gr.Textbox(label="
|
101 |
max_new_tokens_question = gr.Slider(10, 512, value=128, label="Max New Tokens")
|
102 |
temperature_question = gr.Slider(0.1, 1.0, value=0.7, label="Temperature")
|
103 |
question_button = gr.Button("Get Answer")
|
@@ -108,6 +108,4 @@ with gr.Blocks() as demo:
|
|
108 |
outputs=output_text_question)
|
109 |
clear_button_question.click(fn=clear_all, outputs=[input_text_question, question, output_text_question])
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
3 |
|
4 |
+
# Load model and tokenizer
|
5 |
model = T5ForConditionalGeneration.from_pretrained("Addaci/mT5-small-experiment-13-checkpoint-2790")
|
6 |
tokenizer = T5Tokenizer.from_pretrained("Addaci/mT5-small-experiment-13-checkpoint-2790")
|
7 |
|
|
|
65 |
|
66 |
# Interface layout
|
67 |
with gr.Blocks() as demo:
|
68 |
+
gr.HTML("<h1>Marinelives mT5-small Legal Assistant</h1>")
|
69 |
gr.HTML(clickable_buttons())
|
70 |
|
71 |
with gr.Tab("Correct Raw HTR"):
|
72 |
+
input_text = gr.Textbox(lines=10, label="Input Text")
|
73 |
+
output_text = gr.Textbox(label="Corrected Text")
|
74 |
max_new_tokens = gr.Slider(10, 512, value=128, label="Max New Tokens")
|
75 |
temperature = gr.Slider(0.1, 1.0, value=0.7, label="Temperature")
|
76 |
correct_button = gr.Button("Correct HTR")
|
|
|
82 |
clear_button.click(fn=clear_all, outputs=[input_text, output_text])
|
83 |
|
84 |
with gr.Tab("Summarize Legal Text"):
|
85 |
+
input_text_summarize = gr.Textbox(lines=10, label="Input Text")
|
86 |
+
output_text_summarize = gr.Textbox(label="Summary")
|
87 |
max_new_tokens_summarize = gr.Slider(10, 512, value=256, label="Max New Tokens")
|
88 |
temperature_summarize = gr.Slider(0.1, 1.0, value=0.5, label="Temperature")
|
89 |
summarize_button = gr.Button("Summarize Text")
|
|
|
95 |
clear_button_summarize.click(fn=clear_all, outputs=[input_text_summarize, output_text_summarize])
|
96 |
|
97 |
with gr.Tab("Answer Legal Question"):
|
98 |
+
input_text_question = gr.Textbox(lines=10, label="Input Text")
|
99 |
+
question = gr.Textbox(label="Question")
|
100 |
+
output_text_question = gr.Textbox(label="Answer")
|
101 |
max_new_tokens_question = gr.Slider(10, 512, value=128, label="Max New Tokens")
|
102 |
temperature_question = gr.Slider(0.1, 1.0, value=0.7, label="Temperature")
|
103 |
question_button = gr.Button("Get Answer")
|
|
|
108 |
outputs=output_text_question)
|
109 |
clear_button_question.click(fn=clear_all, outputs=[input_text_question, question, output_text_question])
|
110 |
|
111 |
+
demo.launch()
|
|
|
|