Spaces:
Running
Running
ZeroCommand
commited on
Commit
•
384deb6
1
Parent(s):
263c173
change inf type to k-v pair
Browse files- app.py +1 -1
- config.yaml +1 -2
- utils.py +2 -2
app.py
CHANGED
@@ -266,7 +266,7 @@ with gr.Blocks(theme=theme) as iface:
|
|
266 |
''')
|
267 |
with gr.Row():
|
268 |
run_local = gr.Checkbox(value=True, label="Run in this Space")
|
269 |
-
use_inference = read_inference_type('./config.yaml')
|
270 |
run_inference = gr.Checkbox(value=use_inference, label="Run with Inference API")
|
271 |
|
272 |
with gr.Row() as advanced_row:
|
|
|
266 |
''')
|
267 |
with gr.Row():
|
268 |
run_local = gr.Checkbox(value=True, label="Run in this Space")
|
269 |
+
use_inference = read_inference_type('./config.yaml') == 'hf_inference_api'
|
270 |
run_inference = gr.Checkbox(value=use_inference, label="Run with Inference API")
|
271 |
|
272 |
with gr.Row() as advanced_row:
|
config.yaml
CHANGED
@@ -6,5 +6,4 @@ detectors:
|
|
6 |
- underconfidence
|
7 |
- overconfidence
|
8 |
- spurious_correlation
|
9 |
-
inference_type:
|
10 |
-
- hf_inference_api
|
|
|
6 |
- underconfidence
|
7 |
- overconfidence
|
8 |
- spurious_correlation
|
9 |
+
inference_type: hf_pipeline
|
|
utils.py
CHANGED
@@ -38,9 +38,9 @@ def write_inference_type(use_inference):
|
|
38 |
with open(YAML_PATH, "r") as f:
|
39 |
config = yaml.load(f, Loader=yaml.FullLoader)
|
40 |
if use_inference:
|
41 |
-
config["inference_type"] =
|
42 |
else:
|
43 |
-
config["inference_type"] =
|
44 |
with open(YAML_PATH, "w") as f:
|
45 |
# save inference_type to inference_type in yaml
|
46 |
yaml.dump(config, f, Dumper=Dumper)
|
|
|
38 |
with open(YAML_PATH, "r") as f:
|
39 |
config = yaml.load(f, Loader=yaml.FullLoader)
|
40 |
if use_inference:
|
41 |
+
config["inference_type"] = 'hf_inference_api'
|
42 |
else:
|
43 |
+
config["inference_type"] = 'hf_pipeline'
|
44 |
with open(YAML_PATH, "w") as f:
|
45 |
# save inference_type to inference_type in yaml
|
46 |
yaml.dump(config, f, Dumper=Dumper)
|