Download debug_api.py from omgy/vero_ps: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/omgy/vero_ps/resolve/main/debug_api.py
- Command line
-
hf download hf://spaces/omgy/vero_ps/debug_api.py
-
curl -L -o debug_api.py https://huggingface.co/spaces/omgy/vero_ps/resolve/main/debug_api.py
1.09 kB
| 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() | |