bvishnu123's picture
Update app.py
3dede03 verified
raw
history blame
No virus
1.1 kB
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()