Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -55,8 +55,11 @@ async def upload_image(fields:str, model:str, file: UploadFile = File(...)):
|
|
55 |
response = json.loads(response)
|
56 |
|
57 |
# Step 3: Convert fields and values into key-value pairs
|
|
|
|
|
58 |
if 'fields' in response and 'values' in response:
|
59 |
-
response =
|
|
|
60 |
|
61 |
# response flattening
|
62 |
response = flatten(response)
|
|
|
55 |
response = json.loads(response)
|
56 |
|
57 |
# Step 3: Convert fields and values into key-value pairs
|
58 |
+
# if 'fields' in response and 'values' in response:
|
59 |
+
# response = dict(zip(response['fields'], response['values']))
|
60 |
if 'fields' in response and 'values' in response:
|
61 |
+
response = {key: (None if value == "null" else value) for key, value in zip(response['fields'], response['values'])}
|
62 |
+
|
63 |
|
64 |
# response flattening
|
65 |
response = flatten(response)
|