Commit
·
4708837
1
Parent(s):
df1aa82
Run ML worker from Gradio
Browse files
app.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
-
iface = gr.Interface(fn=
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import asyncio
|
3 |
+
from giskard.ml_worker.ml_worker import MLWorker
|
4 |
|
5 |
+
def run_ml_worker(url, api_key, hf_token):
|
6 |
+
# Always run an external ML worker
|
7 |
+
ml_worker = MLWorker(False, url, api_key, hf_token)
|
8 |
+
asyncio.get_event_loop().run_until_complete(ml_worker.start())
|
9 |
+
return "ML worker finished its work"
|
10 |
|
11 |
+
iface = gr.Interface(fn=run_ml_worker, inputs=["text", "text", "text"], outputs="text")
|
12 |
iface.launch()
|