Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Creating an AI-powered service for detecting fraudulent card transactions

Train and deploy an AI model using OpenShift AI, then integrate it into an application running on OpenShift

July 29, 2024
Yashwanth Maheshwaram
Related topics:
Artificial intelligenceKubernetesPython
Related products:
Red Hat OpenShift AI

    As AI and machine learning become integral to modern applications, developers need robust platforms that simplify the development and deployment process. Red Hat OpenShift AI offers a powerful and flexible environment tailored for these needs, making it easier for AI engineers and DevOps teams to collaborate and deliver high-quality AI solutions. In this blog post, we’ll explore how to set up a fraud detection system using Red Hat OpenShift AI, complete with a practical example and a demo API.

    Developer experience with OpenShift

    OpenShift AI simplifies the journey for teams working on AI applications. Utilizing OpenShift AI and Red Hat OpenShift, developers can enjoy a streamlined and efficient workflow. Let's take a look at an overview of the process:

    OpenShift Developer Experience for Intelligent Applications
    1. Access Jupyter Notebook: Begin by accessing the Jupyter Notebook on OpenShift AI. This environment is ideal for AI engineers to experiment and develop their models.
    2. Gather & Prepare Data: Collect and preprocess the data necessary for training the fraud detection model. Ensuring high-quality data is crucial for building an accurate model.
    3. Build the Model: Develop the fraud detection model using machine learning algorithms. The Jupyter Notebook provides a convenient interface for this step.
    4. Train the Model: Train your model using the prepared dataset. This involves adjusting the model parameters to improve its accuracy in detecting fraudulent activities.
    5. Save the Model: Once the model is trained, save it for future deployment. This step ensures that the model can be easily accessed and utilized in the application.
    6. Deploy the Model: Deploy the trained model using OpenShift AI. This platform streamlines the deployment process, making it simple for AI engineers and DevOps teams to collaborate.
    7. Integrate the Model: Integrate the deployed model into your application locally. This step involves ensuring that the application can interact with the model to perform real-time fraud detection.
    8. Deploy the Application: Finally, deploy the application, ensuring that the fraud detection model is fully functional within the operational environment.

    Red Hat Developer Sandbox, along with Red Hat OpenShift and Red Hat OpenShift AI are free to use and readily available for to try out the developer experience with these products. Signup for the Red Hat Developer Sandbox now!

    Build, train, store, and serve the model using OpenShift AI Sandbox

    Red Hat OpenShift AI streamlines the entire lifecycle of AI models. You can build and train your machine learning models within a Jupyter Notebook environment on OpenShift AI, ensuring a seamless development process. Once trained, models are easily stored using integrated solutions like Minio, providing secure and scalable storage. Deploying these models for serving is straightforward with OpenShift AI, enabling efficient and reliable inference. This end-to-end support simplifies AI workflows, allowing teams to focus on innovation.

    For a detailed example of implementing a fraud detection system, you can refer to the OpenShift AI tutorial - Fraud detection example. This tutorial provides a comprehensive guide to setting up and deploying a fraud detection model using OpenShift AI. 

    By the end of 4.2 on the article, you will have a model deployed on OpenShift AI. Once you have that we will need a service that does the job of connecting to the model. 

    Model Serving on OpenShift AI

     

    Create a service that talks to the model

    Integrate the fraud detection AI model into your API to identify fraudulent transactions. The provided Python application uses Flask to set up an API endpoint that processes transaction data. It loads a pre-trained scaler for data normalization and constructs a request to the model server. Depending on the environment, the app uses a different URL for the model server, ensuring flexibility. When a transaction is submitted, the app preprocesses the data, sends it to the model server for inference, and returns a response indicating if the transaction is fraudulent. For more details, see app.py.

    Here’s a brief overview of what's going on:

    1. Receives data via POST request
    2. Scales the data using a pre-loaded scaler
    3. Sends the scaled data to a model server
    4. Processes the model’s response to classify the data as ‘fraud’ or ‘not fraud’
    5. Responds with the classification result

    This internal platform service enables other applications on your cluster to interface with the AI model. The service accepts an array in the format:

    [distance, ratio_to_median, pin, chip, online]

    It responds with a message indicating whether the transaction is fraudulent:

    {
       "message": "fraud/not fraud"
    }

    Deploying the service to the Developer Sandbox

    OpenShift simplifies application deployment through its Source-to-Image (S2I) feature, making it an ideal choice for developers who want to deploy applications quickly without diving into the complexities of container management. S2I streamlines the process by automating the creation of container images from source code. OpenShift’s S2I feature makes application deployment fast and efficient, allowing developers to focus on coding rather than managing containers. This streamlined approach not only speeds up the development process but also simplifies the deployment of applications in a modern cloud-native environment.

    1. Copy the Repository URL: Start by copying the URL of your repository.
    2. Log in to OpenShift Developer Sandbox: Access your OpenShift Developer Sandbox and log in.
    3. Navigate to the Developer View: Once logged in, switch to the Developer view.
    4. Add a New Application: Click on the “+Add” button.
    5. Import from Git: Select the “Import from Git” option.
      1. Import from git
    6. Paste Repository URL: Paste the URL of your repository into the provided field.
    7. Configure Port and Create: Set the port to 5000 and click on the “Create” button. 
      1. Deployment
    8. . Monitor Build Progress: Wait for the build process to complete. Once finished, you should see your application in the topology view.
      1. Topology
    9. Test Your Service: To verify the deployment, execute a POST request in your terminal:
      1. curl -X POST http://<ENTER YOUR ENDPOINT> -H "Content-Type: application/json" -d '{"data": [100, 1.2, 0.0, 0.0, 1.0]}'

    Test a bit more

    Case 1: Not a fradulent transaction

    In this example, the user is buying a coffee. The parameters given to the model are:
    • same location as the last transaction (distance=0)
    • same median price as the last transaction (ratio_to_median=1)
    • using a pin number (pin=1)
    • using the credit card chip (chip=1)
    • not an online transaction (online=0)
    `[0.0, 1.0, 1.0, 1.0, 0.0]`
    curl -X POST http://<ENTER YOUR ENDPOINT> -H "Content-Type: application/json" -d '{"data": [0.0, 1.0, 1.0, 1.0, 0.0]}'

    Case 2: Fraudulent transaction

    In this example, someone stole the user's credit card and is buying something online. The parameters given to the model are:
    • very far away from the last transaction (distance=100)
    • median price similar to the last transaction (ratio_to_median=1.2)
    • not using a pin number (pin=0)
    • not using the credit card chip (chip=0)
    • is an online transaction (online=1)
    [100, 1.2, 0.0, 0.0, 1.0]
    curl -X POST http://<ENTER YOUR ENDPOINT> -H "Content-Type: application/json" -d '{"data": [100, 1.2, 0.0, 0.0, 1.0]}'
    
    Try your own requests and have some fun :)

    By leveraging Red Hat OpenShift AI, businesses can significantly enhance their Developer Expeirence for AI Engineers, Platform Engineers and Application Developers. The platform with Red Hat OpenShift and OpenShift AI simplifies the development and deployment process, providing a seamless experience for AI engineers and DevOps teams. By following the steps outlined in this blog post and utilizing the provided resources, you can build, deploy and serve intelligent applications that leverage AI models.

    Last updated: September 5, 2025

    Related Posts

    • How to integrate Quarkus applications with OpenShift AI

    • How to train a BERT machine learning model with OpenShift AI

    • Create an OpenShift AI environment with Snorkel

    • Red Hat OpenShift AI installation and setup

    • ​​Try OpenShift AI and integrate with Apache Camel

    • Model training in Red Hat OpenShift AI

    Recent Posts

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    What’s up next?

    Learning Path LLM Node.js learning path feature image

    How to get started with large language models and Node.js

    Learn how to access a large language model using Node.js and LangChain.js....
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.