File size: 1,099 Bytes
a479e48
3dbaaa3
 
a479e48
7adfed6
3dbaaa3
92d606f
3dbaaa3
 
 
 
 
3dede03
 
 
 
 
3dbaaa3
3dede03
a479e48
7adfed6
 
 
 
 
 
3dede03
 
7adfed6
 
 
 
a479e48
7adfed6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gradio as gr
from fake_job_detector.models import DistilBERTBaseModel


def process_input(title, description):
# Load the safetensors
    safetensors_path = "synthetic_data_5epoch"

# Load the DistilBERT model
    model = DistilBERTBaseModel(safetensors_path)

    result = model(title, description)
    verdict = ""
    if (result):
        verdict = "This job advertisement is likely fraudulent!"
    else:
        verdict = "This job advertisement is unlikely to be fraudulent."
    
    return verdict

def main():
    # Define the interface
    interface = gr.Interface(
        fn=process_input,  # the function to process input
        inputs=[gr.Textbox(label="Title"), gr.Textbox(label="Description", lines=4)],  # input fields
        outputs=gr.Textbox(label="Output"),  # output field
        title="Fraudulent Job Advertisement Detection",
        description="This model aims to detect fraudulent job advertisements given their title and desscription for COMP6713: NLP project"
    )
    
    # Launch the interface
    interface.launch()

if __name__ == "__main__":
    main()