Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -51,8 +51,14 @@ def evaluate_pci_compliance(audit_data):
|
|
51 |
return compliance_analysis
|
52 |
|
53 |
def analyze_json_file(file_obj):
|
54 |
-
# Assuming file_obj is a file-like object
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
json_data = json.loads(file_str)
|
57 |
audit_data = json.dumps(json_data, indent=2) # Convert JSON to a formatted string
|
58 |
return audit_data
|
|
|
51 |
return compliance_analysis
|
52 |
|
53 |
def analyze_json_file(file_obj):
|
54 |
+
# Assuming file_obj is a file-like object from Gradio
|
55 |
+
try:
|
56 |
+
# Read and decode the file if it's a file-like object
|
57 |
+
file_str = file_obj.read().decode("utf-8")
|
58 |
+
except AttributeError:
|
59 |
+
# Handle if it's a byte string directly
|
60 |
+
file_str = file_obj.decode("utf-8")
|
61 |
+
|
62 |
json_data = json.loads(file_str)
|
63 |
audit_data = json.dumps(json_data, indent=2) # Convert JSON to a formatted string
|
64 |
return audit_data
|