Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,10 +37,17 @@ def apifunction():
|
|
| 37 |
print('here',data)
|
| 38 |
# Extracting values
|
| 39 |
if data:
|
| 40 |
-
# allapi
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
except Exception as e:
|
| 46 |
print(f"Error: {e}")
|
|
|
|
| 37 |
print('here',data)
|
| 38 |
# Extracting values
|
| 39 |
if data:
|
| 40 |
+
# If `data` contains `allapi` as a string, parse it
|
| 41 |
+
if isinstance(data.get("allapi"), str):
|
| 42 |
+
import json
|
| 43 |
+
allapi = json.loads(data["allapi"])
|
| 44 |
+
else:
|
| 45 |
+
allapi = data.get("allapi")
|
| 46 |
+
|
| 47 |
+
# Pass parsed `allapi` to `apiFiltering`
|
| 48 |
+
jsonOutput = pdftotext.apiFiltering(allapi)
|
| 49 |
+
return jsonify(jsonOutput)
|
| 50 |
+
|
| 51 |
|
| 52 |
except Exception as e:
|
| 53 |
print(f"Error: {e}")
|