Spaces:
Build error
Build error
Small fix to app.py file
Browse filesFixed error in coding for hyperperameter bars at bottom of interface
app.py
CHANGED
@@ -10,6 +10,10 @@ model_id = "google/flan-t5-xl"
|
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
|
12 |
|
|
|
|
|
|
|
|
|
13 |
def correct_htr(raw_htr_text, max_new_tokens, temperature):
|
14 |
try:
|
15 |
logging.info("Processing HTR correction with Flan-T5...")
|
@@ -101,10 +105,11 @@ with gr.Blocks() as demo:
|
|
101 |
answer_button.click(answer_question, inputs=[legal_text_input_q, question_input, max_new_tokens, temperature], outputs=answer_output)
|
102 |
clear_button.click(lambda: ("", "", ""), outputs=[legal_text_input_q, question_input, answer_output])
|
103 |
|
104 |
-
#
|
105 |
with gr.Row():
|
106 |
-
|
107 |
-
|
108 |
|
109 |
# Launch the Gradio interface
|
110 |
-
|
|
|
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
|
12 |
|
13 |
+
# Define the sliders outside the gr.Row() block
|
14 |
+
max_new_tokens = gr.Slider(minimum=10, maximum=1000, value=500, step=1, label="Max New Tokens")
|
15 |
+
temperature = gr.Slider(minimum=0.1, maximum=1.0, value=0.7, step=0.1, label="Temperature")
|
16 |
+
|
17 |
def correct_htr(raw_htr_text, max_new_tokens, temperature):
|
18 |
try:
|
19 |
logging.info("Processing HTR correction with Flan-T5...")
|
|
|
105 |
answer_button.click(answer_question, inputs=[legal_text_input_q, question_input, max_new_tokens, temperature], outputs=answer_output)
|
106 |
clear_button.click(lambda: ("", "", ""), outputs=[legal_text_input_q, question_input, answer_output])
|
107 |
|
108 |
+
# The sliders are already defined, so just include them in the layout
|
109 |
with gr.Row():
|
110 |
+
# No need to redefine max_new_tokens and temperature here
|
111 |
+
pass
|
112 |
|
113 |
# Launch the Gradio interface
|
114 |
+
if __name__ == "__main__":
|
115 |
+
demo.launch()
|