Marthee commited on
Commit
92d9ef6
·
verified ·
1 Parent(s): 17edfb7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -37,10 +37,17 @@ def apifunction():
37
  print('here',data)
38
  # Extracting values
39
  if data:
40
- # allapi = data.get('allapi')
41
- jsonOutput=pdftotext.apiFiltering(data)
42
-
43
- return jsonify(jsonOutput)
 
 
 
 
 
 
 
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}")