| import streamlit as st |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification |
| import torch |
|
|
| |
| model_name = "tajuarAkash/test2" |
|
|
| tokenizer = AutoTokenizer.from_pretrained(model_name) |
| model = AutoModelForSequenceClassification.from_pretrained(model_name) |
|
|
| |
| st.title("Fraud Detection in Health Insurance Claims") |
|
|
| |
| st.write("This app predicts whether a health insurance claim is fraudulent based on the input data.") |
|
|
| |
| input_text = st.text_area("Enter the claim description") |
|
|
| |
| if st.button('Predict Fraud'): |
| if input_text: |
| |
| inputs = tokenizer(input_text, return_tensors="pt", padding=True, truncation=True, max_length=512) |
|
|
| |
| with torch.no_grad(): |
| logits = model(**inputs).logits |
| predicted_class = torch.argmax(logits, dim=-1).item() |
|
|
| |
| if predicted_class == 1: |
| st.write("This claim is predicted to be fraudulent.") |
| else: |
| st.write("This claim is predicted to be legitimate.") |
| else: |
| st.write("Please enter a claim description.") |
|
|