ayushsinha commited on
Commit
9c69e6d
·
verified ·
1 Parent(s): cd3098f

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +22 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ def fill_mask(text):
5
+ model_name = "AventIQ-AI/RoBERTa"
6
+ mask_filler = pipeline("fill-mask", model=model_name)
7
+
8
+ results = mask_filler(text)
9
+
10
+ output = "\n".join([f"{i+1}. {res['sequence']} (Confidence: {res['score']:.4f})" for i, res in enumerate(results)])
11
+ return output
12
+
13
+ iface = gr.Interface(
14
+ fn=fill_mask,
15
+ inputs=gr.Textbox(label="Input Text (Use <mask> for missing word)"),
16
+ outputs=gr.Textbox(label="Predictions"),
17
+ title="RoBERTa Fill Mask",
18
+ description="Enter a sentence with <mask>, and the RoBERTa model will predict the missing word."
19
+ )
20
+
21
+ if __name__ == "__main__":
22
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch
2
+ transformers
3
+ gradio
4
+ sentencepiece