I wanted to scan a JPEG that contains a table into a CSV file, what is the quickest way? ChatGPT seems to fail the tasks, trying a few times, but can't read the data.
The code from ChatGPT is:
import pytesseract
from PIL import Image
import pandas as pd
# Load the image from file
image_path = '/mnt/data/image.png'
image = Image.open(image_path)
# Use tesseract to do OCR on the image
text = pytesseract.image_to_string(image)
# Since the user asked for a CSV, we will need to parse the text into a DataFrame and then save it as CSV
# First, we need to split the text into lines
lines = text.split('\n')
# Find the line that contains column headers to determine the structure of the table
column_headers = []
for line in lines:
if 'Item No.' in line and 'Amount' in line:
column_headers = line.split()
break
# Check if column headers have been found
if column_headers:
# Initialize a dictionary to hold our columns
columns = {header: [] for header in column_headers}
# Now go through all lines and if a line has the same number of elements as the headers, add it to columns
for line in lines:
elements = line.split()
if len(elements) == len(column_headers):
for header, element in zip(column_headers, elements):
columns[header].append(element)
# Convert the dictionary to a DataFrame
df = pd.DataFrame(columns)
# Save the DataFrame to a CSV file
csv_path = '/mnt/data/extracted_table.csv'
df.to_csv(csv_path, index=False)
csv_path
else:
'Could not find the column headers in the text.'
Steem to the Moon🚀!
- You can swap the STEEM/SBD to ETH (Ethereum) via steem2eth!
- You can swap the STEEM/SBD to Tether USDT (TRC-20) via steem2usdt!
- You can swap the STEEM/SBD to TRX (TRON) via steem2trx!
- You can swap the STEEM/SBD to BTS (BitShares) via steem2bts!
- Register a free STEEM account at SteemYY!
ChatGPT Use Cases
- How ChatGPT Solves a Math Puzzle?
- ChatGPT Designs a Health Check Tool in Node.Js to Run on Free VPS Instance
- ChatGPT-4 uses Math Wolfram Plugin to Solve a Math Brain Teaser Question
- ChatGPT Refactors/Rewrites the Code using Promise.All - Sending Requests in Parallel
- ChatGPT Use Case: A Good Personal AI Assistant to Help You Write Emails
- Programming Language Conversion Tool based on ChatGPT AI
ChatGPT - AGI (Artificial General Intelligence)
- What is going to be the next trend in technology in the next 10 years?
- Asking ChatGPT the Price of a Bitcoin (Does ChatGPT Predict or Estimate?)
- On Waiting List of ChatGPT 4 API
- The System Design of Steem Blockchain (ChatGPT DApps) Bots
- Integrating ChatGPT Prompt AI to STEEM blockchain
- ChatGPT Gives a Correct Leetcode Solution (Rust: Binary Search Algorithm) after Several Attempts
- ChatGPT Fails to Solve the Sudoku
- OpenAI Text Classifier Fails to Detect ChatGPT Text
- Quantum Computing in Simple Terms (ChatGPT vs Notion AI)
- How ChatGPT Impacts UGC (User Generate Content)?
- The Young Prompt Engineers
!ask how to Read the Text from Image?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
There are several ways to read text from an image. Depending on the type of image, optical character recognition (OCR) software can be used to convert the text into a digital format. Additionally, online tools such as iLovePDF and Free OCR offer free OCR services to extract text from images. If you're working with a PDF file, Adobe Acrobat Pro or Google Drive can also be used to select and copy the text from the image.
command: !ask is powered by witness @justyy and his contributions are: https://steemyy.com
More commands are coming!.
!ask is currently based on ChatGPT-3.5
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
If you want to watch and create high-quality content, such as photos and videos, I recommend a program that can open png files, edit them with precision, and enhance their quality effortlessly. It offers great tools and features to make your projects shine. With its user-friendly interface, even beginners can navigate it easily. Plus, it supports a wide range of formats, making it versatile for any creative task.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit