Nathan Fradet
commited on
add compute method for gradio interface
Browse files
app.py
CHANGED
|
@@ -17,8 +17,13 @@ else:
|
|
| 17 |
(feature_names, feature_types) = zip(*module.features.items())
|
| 18 |
gradio_input_types = evaluate.utils.infer_gradio_input_types(feature_types)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
gradio_app = gr.Interface(
|
| 21 |
-
fn=
|
| 22 |
inputs=gr.Dataframe(
|
| 23 |
headers=feature_names,
|
| 24 |
col_count=len(feature_names),
|
|
|
|
| 17 |
(feature_names, feature_types) = zip(*module.features.items())
|
| 18 |
gradio_input_types = evaluate.utils.infer_gradio_input_types(feature_types)
|
| 19 |
|
| 20 |
+
|
| 21 |
+
def compute(data):
|
| 22 |
+
return module.compute(**evaluate.utils.parse_gradio_data(data, gradio_input_types))
|
| 23 |
+
|
| 24 |
+
|
| 25 |
gradio_app = gr.Interface(
|
| 26 |
+
fn=compute,
|
| 27 |
inputs=gr.Dataframe(
|
| 28 |
headers=feature_names,
|
| 29 |
col_count=len(feature_names),
|