Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,14 +17,20 @@ def get_model_output(input_text):
|
|
17 |
}
|
18 |
#output = query({"inputs": "The answer to the universe is <mask>.", })
|
19 |
output = query(payload)
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# Define Gradio interface
|
23 |
demo = gr.Interface(
|
24 |
fn=get_model_output,
|
25 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter a sentence with <mask> to fill..."),
|
26 |
outputs="json", # Display the output as JSON to inspect the response structure
|
27 |
-
title="nasa-smd-ibm-v0.1 Model Output",
|
28 |
description="Input a sentence with <mask> to see the model's predictions."
|
29 |
)
|
30 |
|
|
|
17 |
}
|
18 |
#output = query({"inputs": "The answer to the universe is <mask>.", })
|
19 |
output = query(payload)
|
20 |
+
results = []
|
21 |
+
for item in output:
|
22 |
+
sequence = item.get('sequence', '')
|
23 |
+
score = item.get('score', 0)
|
24 |
+
results.append(f"{sequence} (Score: {score:.4f})")
|
25 |
+
return "\n".join(results)
|
26 |
+
|
27 |
|
28 |
# Define Gradio interface
|
29 |
demo = gr.Interface(
|
30 |
fn=get_model_output,
|
31 |
+
inputs=gr.Textbox(lines=2, label="Input with mask token", placeholder="Enter a sentence with <mask> to fill..."),
|
32 |
outputs="json", # Display the output as JSON to inspect the response structure
|
33 |
+
title="nasa-smd-ibm-v0.1 Model Output (Fill Mask)",
|
34 |
description="Input a sentence with <mask> to see the model's predictions."
|
35 |
)
|
36 |
|