ml-worker / app.py
weixuan-giskard's picture
Run ML worker from Gradio
4708837
raw
history blame
435 Bytes
import gradio as gr
import asyncio
from giskard.ml_worker.ml_worker import MLWorker
def run_ml_worker(url, api_key, hf_token):
# Always run an external ML worker
ml_worker = MLWorker(False, url, api_key, hf_token)
asyncio.get_event_loop().run_until_complete(ml_worker.start())
return "ML worker finished its work"
iface = gr.Interface(fn=run_ml_worker, inputs=["text", "text", "text"], outputs="text")
iface.launch()