Netrava commited on
Commit
5e89f8a
Β·
verified Β·
1 Parent(s): 2d61c2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -21,7 +21,7 @@ try:
21
  spec.loader.exec_module(omniparser_module)
22
 
23
  # 3. Get the OmniParser class from the successfully loaded module, with the correct casing.
24
- OmniParser = omniparser_module.Omniparser # <-- THE TYPO IS FIXED HERE
25
  print("DEBUG: Successfully loaded Omniparser class using importlib.")
26
 
27
  except Exception as e:
@@ -32,8 +32,9 @@ except Exception as e:
32
 
33
  # --- The rest of the application ---
34
  print("Initializing model...")
35
- # This line will now work.
36
- parser_instance = OmniParser.from_model_path("omniparser-v2-effnet")
 
37
  print("βœ… OmniParser model loaded successfully.")
38
 
39
  def parse_document(input_file):
 
21
  spec.loader.exec_module(omniparser_module)
22
 
23
  # 3. Get the OmniParser class from the successfully loaded module, with the correct casing.
24
+ OmniParser = omniparser_module.Omniparser
25
  print("DEBUG: Successfully loaded Omniparser class using importlib.")
26
 
27
  except Exception as e:
 
32
 
33
  # --- The rest of the application ---
34
  print("Initializing model...")
35
+
36
+ # THIS IS THE FINAL FIX: Call the class constructor directly.
37
+ parser_instance = OmniParser(model_path="omniparser-v2-effnet")
38
  print("βœ… OmniParser model loaded successfully.")
39
 
40
  def parse_document(input_file):