import requests import os from docx import Document # Backend URL URL = "https://omgy-vero-ps.hf.space/enhance" def test_docx_upload(): print("Testing DOCX upload...") # Create a dummy docx doc = Document() doc.add_paragraph("This is a test document with enough text to pass the validation check.") doc.add_paragraph("It has multiple paragraphs to ensure proper extraction.") doc.save("test.docx") try: files = {'file': open('test.docx', 'rb')} params = {'prompt': 'Enhance this', 'doc_type': 'auto'} response = requests.post(URL, files=files, params=params) print(f"Status Code: {response.status_code}") if response.status_code != 200: print(f"Response Body: {response.text}") else: print("Success! Received enhanced file.") except Exception as e: print(f"Error: {str(e)}") finally: files['file'].close() if os.path.exists("test.docx"): os.remove("test.docx") if __name__ == "__main__": test_docx_upload()