WebashalarForML commited on
Commit
bef34b1
·
verified ·
1 Parent(s): 9aa0db6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1655,7 +1655,9 @@ scratch_keywords = [
1655
  def extract_images_from_pdf(pdf_path: Path, json_base_dir: Path):
1656
  ''' Extract images from PDF and generate structured sprite JSON '''
1657
  try:
1658
- pdf_filename = pdf_path.stem # e.g., "scratch_crab" from Path object
 
 
1659
  print("-------------------------------pdf_filename-------------------------------",pdf_filename)
1660
  # Create subfolders under the provided base directories
1661
  # This will create paths like:
@@ -1793,8 +1795,8 @@ def extract_images_from_pdf(pdf_path: Path, json_base_dir: Path):
1793
 
1794
  manipulated_json[f"Sprite {sprite_count}"] = {
1795
  "name": name,
1796
- "base64": element["metadata"]["image_base64"], # Keep original base64 if needed
1797
- "file-path": str(extracted_image_subdir), # Store the directory path as string
1798
  "description": description
1799
  }
1800
  sprite_count += 1
 
1655
  def extract_images_from_pdf(pdf_path: Path, json_base_dir: Path):
1656
  ''' Extract images from PDF and generate structured sprite JSON '''
1657
  try:
1658
+ pdf_path = Path(pdf_path)
1659
+ pdf_filename = pdf_path.stem # e.g., "scratch_crab"
1660
+ pdf_dir_path = str(pdf_path.parent).replace("/", "\\")
1661
  print("-------------------------------pdf_filename-------------------------------",pdf_filename)
1662
  # Create subfolders under the provided base directories
1663
  # This will create paths like:
 
1795
 
1796
  manipulated_json[f"Sprite {sprite_count}"] = {
1797
  "name": name,
1798
+ "base64": element["metadata"]["image_base64"],
1799
+ "file-path": pdf_dir_path,
1800
  "description": description
1801
  }
1802
  sprite_count += 1