Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
|
|
|
| 79 |
|
| 80 |
return json.dumps({"results": results}, indent=2)
|
| 81 |
except Exception as e:
|
| 82 |
return f"Error: {str(e)}"
|
| 83 |
|
| 84 |
description = """
|
| 85 |
-
|
| 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
|