fixed static checks

This commit is contained in:
Abubakar Abid 2022-03-24 13:52:46 -07:00
parent 81e4a08a64
commit 946dffc87f
2 changed files with 1 additions and 29 deletions

View File

@ -2780,7 +2780,7 @@ class DatasetViewer(Component):
def get_template_context(self):
return {
"types": [_type.__class__.__name__.lower() for _type in types],
"types": [_type.__class__.__name__.lower() for _type in self.types],
"value": self.value,
**super().get_template_context(),
}

View File

@ -615,34 +615,6 @@ class Interface(Launchable):
else:
return predictions
def process_api(self, data: Dict[str, Any], username: str = None) -> Dict[str, Any]:
flag_index = None
if data.get("example_id") is not None:
example_id = data["example_id"]
if self.cache_examples:
prediction = load_from_cache(self, example_id)
durations = None
else:
prediction, durations = process_example(self, example_id)
else:
raw_input = data["data"]
prediction, durations = self.process(raw_input)
if self.allow_flagging == "auto":
flag_index = self.flagging_callback.flag(
self,
raw_input,
prediction,
flag_option="" if self.flagging_options else None,
username=username,
)
return {
"data": prediction,
"durations": durations,
"avg_durations": self.config.get("avg_durations"),
"flag_index": flag_index,
}
def process_api(self, data: Dict[str, Any], username: str = None) -> Dict[str, Any]:
class RequestApi:
SUBMIT = 0