michaelmc1618 commited on
Commit
98eff7e
·
verified ·
1 Parent(s): decc4c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
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 (e.g., from Gradio)
55
- file_str = file_obj.read().decode("utf-8")
 
 
 
 
 
 
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