Skip to content

Commit

Permalink
Merge pull request gradio-app#40 from elgeish/feature/key_values_fix
Browse files Browse the repository at this point in the history
Fix key_values and a typo
  • Loading branch information
dawoodkhan82 authored Aug 5, 2020
2 parents 4b69268 + 2887159 commit ebb6449
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions gradio/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def rebuild(self, dir, data):
class KeyValues(AbstractOutput):
'''
Component displays a table representing values for multiple fields.
Output type: List[Tuple[str, value]]
Output type: Dict[str, value]
'''

def __init__(self, label=None):
Expand Down Expand Up @@ -249,7 +249,7 @@ def postprocess(self, prediction):
if isinstance(prediction, str) or isinstance(prediction, int) or isinstance(prediction, float):
return str(prediction)
else:
raise ValueError("The `Textbox` output interface expects an output that is one of: a string, or"
raise ValueError("The `HighlightedText` output interface expects an output that is one of: a string, or"
"an int/float that can be converted to a string.")


Expand Down
6 changes: 3 additions & 3 deletions gradio/static/js/interfaces/output/key_values.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const key_values = {
init: function(opts) {},
output: function(data) {
let html = ""
for (let row of data) {
for (const [key, value] of Object.entries(data)) {
html += `<tr>
<td>${row[0]}</td>
<td>${row[1]}</td>
<td>${key}</td>
<td>${value}</td>
</tr>`;
}
this.target.find("tbody").html(html);
Expand Down

0 comments on commit ebb6449

Please sign in to comment.