Spaces:
Runtime error
Runtime error
fix
Browse files
app.py
CHANGED
@@ -116,7 +116,6 @@ interface = gr.Interface(
|
|
116 |
],
|
117 |
outputs=[
|
118 |
gr.Markdown(label="output"),
|
119 |
-
gr.Image(show_label=False),
|
120 |
],
|
121 |
submit_btn=gr.Button("Export"),
|
122 |
title=TITLE,
|
|
|
116 |
],
|
117 |
outputs=[
|
118 |
gr.Markdown(label="output"),
|
|
|
119 |
],
|
120 |
submit_btn=gr.Button("Export"),
|
121 |
title=TITLE,
|
export.py
CHANGED
@@ -30,6 +30,7 @@ from optimum.intel.openvino import (
|
|
30 |
)
|
31 |
from optimum.intel.utils.constant import _TASK_ALIASES
|
32 |
from optimum.intel.openvino.utils import _HEAD_TO_AUTOMODELS
|
|
|
33 |
|
34 |
SPACES_URL = "https://huggingface.co/spaces/echarlaix/openvino-export"
|
35 |
|
@@ -49,6 +50,15 @@ def previous_pr(api: "HfApi", model_id: str, pr_title: str) -> Optional["Discuss
|
|
49 |
|
50 |
|
51 |
def convert_openvino(model_id: str, task: str, folder: str) -> List:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
task = _TASK_ALIASES.get(task, task)
|
53 |
if task not in _HEAD_TO_AUTOMODELS:
|
54 |
raise ValueError(f"The task '{task}' is not supported, only {_HEAD_TO_AUTOMODELS.keys()} tasks are supported")
|
|
|
30 |
)
|
31 |
from optimum.intel.utils.constant import _TASK_ALIASES
|
32 |
from optimum.intel.openvino.utils import _HEAD_TO_AUTOMODELS
|
33 |
+
from optimum.exporters import TasksManager
|
34 |
|
35 |
SPACES_URL = "https://huggingface.co/spaces/echarlaix/openvino-export"
|
36 |
|
|
|
50 |
|
51 |
|
52 |
def convert_openvino(model_id: str, task: str, folder: str) -> List:
|
53 |
+
task = TasksManager.map_from_synonym(task)
|
54 |
+
if task == "auto":
|
55 |
+
try:
|
56 |
+
task = TasksManager.infer_task_from_model(model_id)
|
57 |
+
except KeyError as e:
|
58 |
+
raise KeyError(
|
59 |
+
f"The task could not be automatically inferred. Please provide the task argument with the relevant task from {', '.join(TasksManager.get_all_tasks())}. {e}"
|
60 |
+
)
|
61 |
+
|
62 |
task = _TASK_ALIASES.get(task, task)
|
63 |
if task not in _HEAD_TO_AUTOMODELS:
|
64 |
raise ValueError(f"The task '{task}' is not supported, only {_HEAD_TO_AUTOMODELS.keys()} tasks are supported")
|