Spaces:
Runtime error
Runtime error
Commit
·
1bbdc1e
1
Parent(s):
6c63d42
Do not allow modification when `READONLY` env set
Browse files
app.py
CHANGED
@@ -19,6 +19,7 @@ GSK_HUB_URL = 'GSK_HUB_URL'
|
|
19 |
GSK_API_KEY = 'GSK_API_KEY'
|
20 |
HF_SPACE_HOST = 'SPACE_HOST'
|
21 |
HF_SPACE_TOKEN = 'GSK_HUB_HFS'
|
|
|
22 |
|
23 |
LOG_FILE = "output.log"
|
24 |
|
@@ -91,16 +92,21 @@ with gr.Blocks(theme=theme) as iface:
|
|
91 |
url = os.environ.get(GSK_HUB_URL) if os.environ.get(GSK_HUB_URL) else f"http://{settings.host}:{settings.ws_port}"
|
92 |
url_input = gr.Textbox(
|
93 |
label="Giskard Hub URL",
|
|
|
94 |
value=url,
|
95 |
)
|
96 |
api_key_input = gr.Textbox(
|
97 |
label="Giskard Hub API Key",
|
|
|
98 |
type="password",
|
|
|
99 |
placeholder="gsk-xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
100 |
)
|
101 |
hf_token_input = gr.Textbox(
|
102 |
label="Hugging Face Spaces Token",
|
|
|
103 |
type="password",
|
|
|
104 |
info="if using a private Giskard Hub on Hugging Face Spaces",
|
105 |
)
|
106 |
|
@@ -109,7 +115,7 @@ with gr.Blocks(theme=theme) as iface:
|
|
109 |
run_btn = gr.Button("Run", variant="primary")
|
110 |
run_btn.click(start_ml_worker, [url_input, api_key_input, hf_token_input], output)
|
111 |
|
112 |
-
stop_btn = gr.Button("Stop", variant="stop")
|
113 |
stop_btn.click(stop_ml_worker, None, output)
|
114 |
|
115 |
logs = gr.Textbox(label="Giskard ML worker log:")
|
|
|
19 |
GSK_API_KEY = 'GSK_API_KEY'
|
20 |
HF_SPACE_HOST = 'SPACE_HOST'
|
21 |
HF_SPACE_TOKEN = 'GSK_HUB_HFS'
|
22 |
+
READONLY = os.environ.get("READONLY") if os.environ.get("READONLY") else False
|
23 |
|
24 |
LOG_FILE = "output.log"
|
25 |
|
|
|
92 |
url = os.environ.get(GSK_HUB_URL) if os.environ.get(GSK_HUB_URL) else f"http://{settings.host}:{settings.ws_port}"
|
93 |
url_input = gr.Textbox(
|
94 |
label="Giskard Hub URL",
|
95 |
+
interactive=not READONLY,
|
96 |
value=url,
|
97 |
)
|
98 |
api_key_input = gr.Textbox(
|
99 |
label="Giskard Hub API Key",
|
100 |
+
interactive=not READONLY,
|
101 |
type="password",
|
102 |
+
value=os.environ.get(GSK_API_KEY),
|
103 |
placeholder="gsk-xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
104 |
)
|
105 |
hf_token_input = gr.Textbox(
|
106 |
label="Hugging Face Spaces Token",
|
107 |
+
interactive=not READONLY,
|
108 |
type="password",
|
109 |
+
value=os.environ.get(HF_SPACE_TOKEN),
|
110 |
info="if using a private Giskard Hub on Hugging Face Spaces",
|
111 |
)
|
112 |
|
|
|
115 |
run_btn = gr.Button("Run", variant="primary")
|
116 |
run_btn.click(start_ml_worker, [url_input, api_key_input, hf_token_input], output)
|
117 |
|
118 |
+
stop_btn = gr.Button("Stop", variant="stop", interactive=not READONLY)
|
119 |
stop_btn.click(stop_ml_worker, None, output)
|
120 |
|
121 |
logs = gr.Textbox(label="Giskard ML worker log:")
|