from gradio_client import Client, handle_file client = Client("http://127.0.0.1:7860/") result_1 = client.predict( local_file_path=handle_file("data/test-document.pdf"), output_format="docx", api_name="/predict" ) print("Link to the document:", result_1) assert ( isinstance(result_1, str) and result_1 is not None # Check if the string itself is not None and result_1.endswith(".docx") ) result_2 = client.predict( document_url="https://raw.githubusercontent.com/kingabzpro/bbc-news-class-mlops/refs/heads/master/README.md", output_format="pdf", api_name="/predict_1", ) print("Link to the document:", result_2) assert ( isinstance(result_2, str) and result_2 is not None # Check if the string itself is not None and result_2.endswith(".pdf") )