Monday, June 5, 2023
ChatGPT/GPT-4 for Receipt OCR Data Analysis
I show how ChatGPT works with array data generated from OCR engine by extracting text from the receipt document. ChatGPT can parse and understand the data. What is great about it - GPT-4 model automatically maps key/value pairs without any additional metadata. For example, it matches the receipt item and item price. I'm using PaddleOCR to construct OCR input for ChatGPT.
Monday, May 29, 2023
Document AI: How To Convert Colab ML Notebook Into FastAPI App
I explain how I converted Donut ML model fine-tuning code implemented as Colab notebook into API running as FastAPI app. I share several hints how to simplify code refactoring efforts.
Labels:
Hugging Face,
Machine Learning,
Python
Monday, May 22, 2023
Speeding Up FastAPI App with Background Tasks
FastAPI runs background tasks in a parallel thread, which prevents blocking app endpoints when a long task executes. I explain it in this video and show the benefit of running time-consuming operations in background tasks.
Labels:
FastAPI,
Machine Learning,
Python
Monday, May 15, 2023
Optimizing FastAPI for Concurrent Users when Running Hugging Face ML Models
To serve multiple concurrent users accessing FastAPI endpoint running Hugging Face API, you must start the FastAPI app with several workers. It will ensure current user requests will not be blocked if another request is already running. I show and describe it in this video.
Labels:
FastAPI,
Hugging Face,
Python
Monday, May 8, 2023
Optimizing ML Model Loading Time Using LRU Cache in FastAPI
Are you facing challenges with the time it takes to load large ML models in your backend API? This video presents a practical solution: utilizing LRU cache with properly annotated functions. Implementing this approach will make your model cached in memory, eliminating the need for disk reads on subsequent calls. Enhance the efficiency and performance of your ML workflow by incorporating LRU cache techniques. Join us to learn more about this valuable strategy!
Monday, April 24, 2023
Efficient Document Data Extraction with Sparrow UI: Streamlit, FastAPI, and Hugging Face's Donut ML
In this easy-to-follow video, I show you how I built Sparrow UI, a tool for pulling data from documents using Streamlit. With Sparrow UI, you can upload a document and quickly run a data extraction task.
I'll walk you through how the system works, using a FastAPI app on the backend to run a fine-tuned Donut ML model from Hugging Face. I'll also explain the code that sends POST requests from the Streamlit app, including how it sends files and text to the FastAPI endpoint. This way, you'll get a JSON response with the extracted info from your document.
Labels:
Machine Learning,
Sparrow
Monday, April 17, 2023
Deploying FastAPI Applications to Hugging Face Spaces
In this video, I demonstrate how to deploy a FastAPI backend API to Hugging Face Spaces using Docker. I cover creating a Dockerfile, setting up secrets for FastAPI, and deploying the application on the platform.
Labels:
FastAPI,
Hugging Face,
Python
Monday, April 10, 2023
Build a Structured API with FastAPI
Learn how to create a structured API using FastAPI. In this tutorial, we explore the benefits of FastAPI, its powerful code structuring capabilities, and how it connects services within Sparrow to build scalable and efficient applications. Unleash the true potential of FastAPI and enhance your app development process!
Monday, March 27, 2023
Donut ML Model Fine-Tuning with Hugging Face API
I explain how Donut ML model can be fine-tuned on your own dataset by following different approaches. Either with PyTorch Lighting or Hugging Face Trainer API. I explain the pros and cons of both and what works best for me.
Labels:
Donut,
Hugging Face,
Python
Tuesday, March 21, 2023
How I'm Using ChatGPT/GPT-4 as a Solo Python Developer
I'm working as a solo Python developer and using ChatGPT to speed up the development process. In this video, I explain how ChatGPT is helping me with various tasks, from code explanation to suggesting solutions.
Sunday, March 12, 2023
Hugging Face Dataset for Donut Model Fine-Tuning (Document AI)
Hugging Face Dataset is a very convenient way to store and share data for ML model fine-tuning. In this post, I share my experience creating a dataset for fine-tuning the Donut model. I made a set of scripts to generate the dataset, push it to the Hub and test it locally.
Labels:
Hugging Face,
Python,
Sparrow
Monday, March 6, 2023
Improve OCR Results with Sparrow (running on Streamlit/Python and Ngrok)
OCR can often generate results in a different order. But to produce a dataset for data extraction ML model fine-tuning (for example - Donut), fields in all documents must be ordered correctly. Our solution (open-source), Sparrow, for data annotation/labeling includes functionality for OCRed field reordering. In this video, I explain and show how it works.
Monday, February 27, 2023
Document Data Extraction - Data Mapping for Donut Model Fine-Tuning Dataset (Document AI)
I explain the current status of my work related to dataset preparation for ML Donut model fine-tuning. I plan to use this model to run data extraction tasks from invoice documents. I share hints about data mapping and how to structure data to achieve better fine-tuning results.
Labels:
Donut,
Machine Learning,
Python
Monday, February 20, 2023
Streamlit Button Group UI (Flowbite) Component
Streamlit doesn't provide an option to display multiple buttons side-by-side horizontally. I explain how to achieve this functionality using a custom Streamlit component and Flowbite button group UI.
Monday, February 13, 2023
Preparing Dataset for Donut Fine-Tuning (part 3, Document AI)
In this episode, I explain redesigned Sparrow UI for data annotation. Sparrow UI is improved with Streamlit Grid component (aggrid). I show how to group related fields generated by OCR into a single entity and map it with the label. I will briefly review the code and discuss how you can set up a grid component in Streamlit - a convenient and helpful UI element.
Labels:
Donut,
Machine Learning,
Sparrow
Monday, February 6, 2023
Preparing Dataset for Donut Fine-Tuning (part 2, Document AI)
I explain how to group OCR results into a single entity using Sparrow annotation tool. This is useful for such fields as an address, item description - when field text is based on multiple words.
Labels:
Donut,
Machine Learning,
Python
Tuesday, January 31, 2023
Preparing Dataset for Donut Fine-Tuning (part 1, Document AI)
I explain the dataset I will be using to fine-tune Donut model. I show how PDFs are converted to image files for further processing and OCR data extraction. In the next step, JSON data is converted to the format understandable by Sparrow annotation processing/review tool.
Labels:
Machine Learning,
Python
Monday, January 23, 2023
How To Fine-tune Donut Model
Donut is an awesome Document AI model to extract data from docs. I share my experiences in fine-tuning the model, with CORD dataset, based on example from Transformers Tutorials.
Labels:
Donut,
Hugging Face,
Machine Learning
Monday, January 16, 2023
Donut 🍩 - ChatGPT for Document AI
Donut - OCR-free Document Understanding Transformer. This ML model can process documents (images, scans) and return JSON structured info about the content. It works for different use cases: form understanding, visual question answering about the document, document image classification.
Labels:
Donut,
Hugging Face,
Machine Learning
Thursday, January 5, 2023
Best Platform for Python Apps Deployment - Hugging Face Spaces with Docker
I walk through Hugging Face Spaces Docker SDK deployment option. I was using it to deploy our Streamlit/Python app Sparrow. So far very happy with Spaces Docker SDK - simple setup, very stable and good runtime performance, HTTPS out of the box, content compression out of the box too.
Labels:
Docker,
Hugging Face,
Python
Subscribe to:
Posts (Atom)