davidberenstein1957 HF staff commited on
Commit
aa23dc4
1 Parent(s): 607292d

fix: update json load workflow workflow

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -33,14 +33,14 @@ def process_fields(fields):
33
  def process_records_gradio(records, fields, question, example_records=None):
34
  try:
35
  # Convert string inputs to dictionaries
36
- records = json.loads(records) if isinstance(records, str) else records
37
- example_records = (
38
- json.loads(example_records)
39
- if example_records and isinstance(example_records, str)
40
- else example_records
41
- )
42
- fields = process_fields(fields) if isinstance(fields, str) else fields
43
- question = json.loads(question) if isinstance(question, str) else question
44
 
45
  if not fields and not question:
46
  raise Exception("Error: Either fields or question must be provided")
 
33
  def process_records_gradio(records, fields, question, example_records=None):
34
  try:
35
  # Convert string inputs to dictionaries
36
+ if isinstance(records, str):
37
+ records = json.loads(records)
38
+ if isinstance(example_records, str):
39
+ example_records = json.loads(example_records)
40
+ if isinstance(fields, str):
41
+ fields = json.loads(fields)
42
+ if isinstance(question, str):
43
+ question = json.loads(question)
44
 
45
  if not fields and not question:
46
  raise Exception("Error: Either fields or question must be provided")