63 lines
1.9 KiB
Python
63 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def process_pitch_deck(pdf_path):
|
|
"""Working version that bypasses the signature mess"""
|
|
print(f"Processing: {pdf_path}")
|
|
|
|
# Import everything we need
|
|
from client import get_openrouter_client
|
|
from pdf_processor import extract_slides_from_pdf
|
|
from analysis import analyze_slides_batch
|
|
|
|
# Extract slides (this works)
|
|
slides = extract_slides_from_pdf(pdf_path, "processed", Path(pdf_path).stem)
|
|
print(f"Extracted {len(slides)} slides")
|
|
|
|
# Analyze slides (this works)
|
|
client = get_openrouter_client()
|
|
analysis_results = analyze_slides_batch(client, slides)
|
|
print("Analysis complete")
|
|
|
|
# Create report manually (bypass the broken create_slide_markdown)
|
|
markdown_content = f"# Pitch Deck Analysis: {Path(pdf_path).stem}\n\n"
|
|
|
|
for i, slide_data in enumerate(slides):
|
|
slide_num = i + 1
|
|
analysis = analysis_results.get(slide_num, {})
|
|
|
|
markdown_content += f"## Slide {slide_num}\n\n"
|
|
markdown_content += f"\n\n"
|
|
|
|
if analysis:
|
|
markdown_content += f"**Analysis:**\n{analysis}\n\n"
|
|
else:
|
|
markdown_content += "**Analysis:** No analysis available\n\n"
|
|
|
|
markdown_content += "---\n\n"
|
|
|
|
# Save report
|
|
output_file = f"processed/{Path(pdf_path).stem}_analysis.md"
|
|
os.makedirs("processed", exist_ok=True)
|
|
|
|
with open(output_file, 'w', encoding='utf-8') as f:
|
|
f.write(markdown_content)
|
|
|
|
print(f"Report saved to: {output_file}")
|
|
return output_file
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) < 2:
|
|
print("Usage: python working_app.py <pdf_path>")
|
|
sys.exit(1)
|
|
|
|
pdf_path = sys.argv[1]
|
|
if not os.path.exists(pdf_path):
|
|
print(f"Error: File '{pdf_path}' not found")
|
|
sys.exit(1)
|
|
|
|
process_pitch_deck(pdf_path)
|