aquibmoin commited on
Commit
4d9a68f
·
verified ·
1 Parent(s): 93c47ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
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
- return output
 
 
 
 
 
 
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