example.py
1 from mlflow.deployments import get_deploy_client 2 3 4 def main(): 5 client = get_deploy_client("http://localhost:7000") 6 7 print(f"Hugging Face TGI endpoints: {client.list_endpoints()}\n") 8 print( 9 f"Hugging Face completions endpoint info: {client.get_endpoint(endpoint='completions')}\n" 10 ) 11 12 # Completions request 13 response_completions = client.predict( 14 endpoint="completions", 15 inputs={ 16 "prompt": ("What is Deep Learning?"), 17 "temperature": 0.1, 18 }, 19 ) 20 21 print(f"Hugging Face TGI response for completions: {response_completions}") 22 23 24 if __name__ == "__main__": 25 main()