replicate/replicate-python

Checking Training Status

ARusterholz-edu opened this issue · 1 comments

I'm writing a Gradio application that uses Replicates API. I'm trying to show the training status in the interface, but I'm having trouble calling it. I've been using this script on the backend to check the status

training.reload()
print(training.status)
if training.status == 'processing':
print("\n".join(training.logs.split("\n")[-15:]))
if training.status == 'succeeded':
print(training)

and I'd like to have similar information displayed in the interface. But I'm having trouble because the training variable doesn't get passed between functions, and I'm having trouble passing it in a way Gradio accepts. I'm not sure what kind of object it is. Is there any documentation about this?

https://replicate.com/docs/reference/http#trainings.get

Nevermind, I'm still learning about API calls and Python. It seems like .status and .logs are ways of referring to the json object outlined in the training get request. So I'll just need to grab the ID when the call is first made and make another http request later to check the status.