mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-25 00:36:55 +02:00
commit
f36a4ece63
5 changed files with 7 additions and 6 deletions
BIN
examples/data/di/dog.jpg
Normal file
BIN
examples/data/di/dog.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
examples/data/di/receipt_shopping.jpg
Normal file
BIN
examples/data/di/receipt_shopping.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
|
@ -1,17 +1,17 @@
|
|||
from metagpt.const import EXAMPLE_DATA_PATH
|
||||
from metagpt.roles.di.data_interpreter import DataInterpreter
|
||||
|
||||
|
||||
async def main():
|
||||
# Notice: pip install metagpt[ocr] before using this example
|
||||
image_path = "image.jpg"
|
||||
image_path = EXAMPLE_DATA_PATH / "di/receipt_shopping.jpg"
|
||||
language = "English"
|
||||
requirement = f"""This is a {language} receipt image.
|
||||
Your goal is to perform OCR on images using PaddleOCR, output text content from the OCR results and discard
|
||||
coordinates and confidence levels, then recognize the total amount from ocr text content, and finally save as table.
|
||||
coordinates and confidence levels, then recognize the total amount from ocr text content, and finally save as csv table.
|
||||
Image path: {image_path}.
|
||||
NOTE: The environments for Paddle and PaddleOCR are all ready and has been fully installed."""
|
||||
di = DataInterpreter()
|
||||
|
||||
di = DataInterpreter(react_mode="react")
|
||||
await di.run(requirement)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import asyncio
|
||||
|
||||
from metagpt.const import DEFAULT_WORKSPACE_ROOT, EXAMPLE_DATA_PATH
|
||||
from metagpt.roles.di.data_interpreter import DataInterpreter
|
||||
|
||||
|
||||
|
|
@ -9,7 +10,7 @@ async def main(requirement: str = ""):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
image_path = "/your/path/to/the/image.jpeg"
|
||||
save_path = "/your/intended/save/path/for/image_rm_bg.png"
|
||||
image_path = EXAMPLE_DATA_PATH / "di/dog.jpg"
|
||||
save_path = DEFAULT_WORKSPACE_ROOT / "image_rm_bg.png"
|
||||
requirement = f"This is a image, you need to use python toolkit rembg to remove the background of the image and save the result. image path:{image_path}; save path:{save_path}."
|
||||
asyncio.run(main(requirement))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue