import requests url = 'http://localhost:7860/api/v1/extract' pdf_path = "pdfs/Enfothelial dysfunction.pdf" try: with open(pdf_path, 'rb') as f: files = {'file': f} response = requests.post(url, files=files) print(f"Status Code: {response.status_code}") print(f"Response Headers: {response.headers}") print(f"Response Text: {response.text}") if response.ok: print("JSON Response:", response.json()) else: print(f"Error: {response.text}") except FileNotFoundError: print(f"Error: Could not find PDF file at {pdf_path}") except requests.exceptions.ConnectionError: print(f"Error: Could not connect to server at {url}. Make sure the server is running.") except Exception as e: print(f"Unexpected error: {str(e)}")