Spaces:
Running
on
Zero
Running
on
Zero
da03
commited on
Commit
•
521b575
1
Parent(s):
1efd23b
app.py
CHANGED
@@ -31,7 +31,7 @@ def predict_product(num1, num2):
|
|
31 |
raw_output = tokenizer.decode(output, skip_special_tokens=True)
|
32 |
prediction = postprocess(raw_output)
|
33 |
|
34 |
-
#
|
35 |
try:
|
36 |
num1_int = int(num1)
|
37 |
num2_int = int(num2)
|
@@ -52,7 +52,7 @@ def predict_product(num1, num2):
|
|
52 |
result_message = "Invalid input. Could not evaluate correctness."
|
53 |
result_html = f"<div style='color: {result_color};'>{result_message}</div>"
|
54 |
|
55 |
-
return
|
56 |
|
57 |
demo = gr.Interface(
|
58 |
fn=predict_product,
|
@@ -61,8 +61,6 @@ demo = gr.Interface(
|
|
61 |
gr.Textbox(label='Second Number (up to 12 digits)', value='67890'),
|
62 |
],
|
63 |
outputs=[
|
64 |
-
gr.Textbox(label='Raw Input to GPT2 (reversed digits and added spaces)'),
|
65 |
-
gr.Textbox(label='Raw Output from GPT2 (reversed digits and with spaces)'),
|
66 |
gr.Textbox(label='Predicted Product'),
|
67 |
gr.HTML(label='Result Message')
|
68 |
],
|
|
|
31 |
raw_output = tokenizer.decode(output, skip_special_tokens=True)
|
32 |
prediction = postprocess(raw_output)
|
33 |
|
34 |
+
# Evaluate the correctness of the result
|
35 |
try:
|
36 |
num1_int = int(num1)
|
37 |
num2_int = int(num2)
|
|
|
52 |
result_message = "Invalid input. Could not evaluate correctness."
|
53 |
result_html = f"<div style='color: {result_color};'>{result_message}</div>"
|
54 |
|
55 |
+
return prediction, result_html
|
56 |
|
57 |
demo = gr.Interface(
|
58 |
fn=predict_product,
|
|
|
61 |
gr.Textbox(label='Second Number (up to 12 digits)', value='67890'),
|
62 |
],
|
63 |
outputs=[
|
|
|
|
|
64 |
gr.Textbox(label='Predicted Product'),
|
65 |
gr.HTML(label='Result Message')
|
66 |
],
|