davidberenstein1957 HF staff commited on
Commit
778c655
1 Parent(s): 61f9c80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -59,10 +59,6 @@ def process_records_gradio(records, example_records, fields, question):
59
  fields = process_fields(fields) if fields else None
60
  question = json.loads(question) if question else None
61
 
62
- print(fields)
63
- print(question)
64
- print(example_records)
65
-
66
  if not fields and not question:
67
  return "Error: Either fields or question must be provided"
68
 
@@ -75,14 +71,15 @@ def process_records_gradio(records, example_records, fields, question):
75
  results = []
76
  for record in records:
77
  output = next(task.process(inputs=[{"records": record}]))
78
- results.append(output[0]["suggestions"].serialize())
 
79
 
80
  return json.dumps({"results": results}, indent=2)
81
  except Exception as e:
82
  return f"Error: {str(e)}"
83
 
84
  description = """
85
- Enter JSON data for `rg.Record.to_dict()`, `List[rg.Record.to_dict()]`, `List[Field].serialize()`, or `List[rg.Question.serialize()]` At least one of fields or question must be provided.
86
 
87
  ```python
88
  import json
 
59
  fields = process_fields(fields) if fields else None
60
  question = json.loads(question) if question else None
61
 
 
 
 
 
62
  if not fields and not question:
63
  return "Error: Either fields or question must be provided"
64
 
 
71
  results = []
72
  for record in records:
73
  output = next(task.process(inputs=[{"records": record}]))
74
+ if output[0]["suggestions"]:
75
+ results.append(output[0]["suggestions"].serialize())
76
 
77
  return json.dumps({"results": results}, indent=2)
78
  except Exception as e:
79
  return f"Error: {str(e)}"
80
 
81
  description = """
82
+ An example workflow for JSON payload.
83
 
84
  ```python
85
  import json