import os import requests PORT = int(os.environ.get('PORT', 7860)) HOST = os.environ.get('HOST', 'http://localhost') URL = f"{HOST}:{PORT}/run/predict" def test_predict(q="¿Hola? Prueba"): try: r = requests.post(URL, json={"data": [q]}, timeout=10) except Exception as e: print('Connection error:', e) return print('status', r.status_code) try: print('json', r.json()) except Exception: print('text', r.text) if __name__ == '__main__': test_predict()