Skip to content

fatih-keles/fn-projects

Repository files navigation

Real life Funtions (Fn) use cases

Save Time

Purpose

Collection of useful FN samples that can be applied to real life scenarios.

List of Projects

  1. Compute Maintenance with Functions
  2. Auto OCR Files
  3. Auto Blur Images

Common Prerequsites

  1. Create Free Oracle Cloud account, start here. It is totaly free, takes less than two minutes. Credit card information is required to verify your identity, no charges will be incurred. You will get free
    • 2 Oracle Autonomous Databases
    • 2 Virtual Machines
    • First 2 million Function invocation
    • First 400K Gb memory * seconds for free for life as long as you use them.
  2. Setup OCI CLI as described here
  3. Setup your functions development environment by choosing one of the options listed here.

Compute Maintenance with Functions

Problem Statement: We have a compute instance that is running on an old version of Windows, and unfortunately we can't upgrade. For reasons known and unkown the OS dies (BSOD) and only a restart can bring it back to life. Without any modernization effort we want to check if the instance is reachable and restart it if necessary. The solution should be cost and time effective, shouldn't add any additional monitoring or automation components.

+-------------------+
| Start             |
+-------------------+
        |
        v
+-------------------+
| Invoke Function   |
| Every 5 Minutes   |
+-------------------+
        |
        v
+-------------------+
| Check if Instance |
| is Reachable      |
+-------------------+
        |
        v
+-------------------+       +-------------------+
| Is Instance       |  Yes  | Log Action in     |
| Reachable?        |------>| Logging Service   |
+-------------------+       +-------------------+
        | No
        v
+-------------------+
| Restart Instance  |
+-------------------+
        |
        v
+-------------------+
| Log Action in     |
| Logging Service   |
+-------------------+
        |
        v
+-------------------+
| Exit              |
+-------------------+

Click 👉 Restart Compute Instance with Functions for complete steps.

Auto OCR Files

OCR Your Files Suppose that we want to automate extracting text from images and non-convertible PDF files when files are uploaded to object storage. Since the files might be bigger than online processing limits of services it creates an asynchronous jobs. After the jobs are completed extracted text is stored in database, as well as searchable PDF document and json outputs are stored under another bucket for later usage.

Main OCI components utilized

  • Object Storage: Storing files and extracts
  • Events: Object storage object creation emits events to invoke functions
  • Functions: Triggered by events, processing documents
  • AI Vision: Extracting text with OCR and searchable pdf generation
  • Autonomous Database: Providing data layer over ORDS for storing extracted text with minimum effort
  • Logging: Logging and debugging event rules and functions

We will provide the functionality in two steps.

  1. Object storage will emit an event when an image or pdf file is uploaded. That event will trigger our first function which will submit an ai vision document job to process files asynchronously.

Click 👉 Part:1 - Submit a Vision document job when a document is uploaded to object storage bucket for complete steps.

  1. Vision service will process files and create output in a temporary bucket. Temporary bucket will emit an event which will trigger our second function. This function will read json output (extracted text) and update a database over ORDS, then move searchable pdf file to final location.

Click 👉 Part:2 - Process output of Vision document job and organize new information for complete steps.

^ back

Auto Blur Images

Blur Images We want to blur faces and number plates when images are uploaded to an object storage bucket. For this purpose bucket will emit an event which will trigger a function and the function will blur the faces and number plates using OpenCv library. In order to use a third party library function uses a custom Dockerfile.

Click 👉 Auto Blur Images for complete steps.

^ back

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published