Spaces:
Runtime error
Runtime error
Commit
·
e05b343
1
Parent(s):
69b1728
Allow to set Giskard key from env
Browse files
app.py
CHANGED
@@ -6,6 +6,8 @@ import subprocess
|
|
6 |
import threading
|
7 |
|
8 |
import sys
|
|
|
|
|
9 |
|
10 |
LOG_FILE = "output.log"
|
11 |
|
@@ -55,6 +57,9 @@ def stop_ml_worker():
|
|
55 |
|
56 |
|
57 |
def start_ml_worker(url, api_key, hf_token):
|
|
|
|
|
|
|
58 |
# Always run an external ML worker
|
59 |
stop_ml_worker()
|
60 |
|
@@ -71,7 +76,11 @@ with gr.Blocks(theme=theme) as iface:
|
|
71 |
with gr.Row():
|
72 |
with gr.Column():
|
73 |
url_input = gr.Textbox(label="Giskard Hub URL")
|
74 |
-
api_key_input = gr.Textbox(
|
|
|
|
|
|
|
|
|
75 |
hf_token_input = gr.Textbox(label="Hugging Face Spaces Token")
|
76 |
|
77 |
output = gr.Textbox(label="Status")
|
|
|
6 |
import threading
|
7 |
|
8 |
import sys
|
9 |
+
import os
|
10 |
+
|
11 |
|
12 |
LOG_FILE = "output.log"
|
13 |
|
|
|
57 |
|
58 |
|
59 |
def start_ml_worker(url, api_key, hf_token):
|
60 |
+
if not url or len(url) < 1:
|
61 |
+
return "Please provide URL of Giskard"
|
62 |
+
|
63 |
# Always run an external ML worker
|
64 |
stop_ml_worker()
|
65 |
|
|
|
76 |
with gr.Row():
|
77 |
with gr.Column():
|
78 |
url_input = gr.Textbox(label="Giskard Hub URL")
|
79 |
+
api_key_input = gr.Textbox(
|
80 |
+
label="Giskard Hub API Key",
|
81 |
+
value=os.environ.get("GSK_API_KEY"),
|
82 |
+
placeholder="gsk-xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
83 |
+
)
|
84 |
hf_token_input = gr.Textbox(label="Hugging Face Spaces Token")
|
85 |
|
86 |
output = gr.Textbox(label="Status")
|