AlineIoste commited on
Commit
fb979a6
·
verified ·
1 Parent(s): 2c3e352

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -14
app.py CHANGED
@@ -35,22 +35,35 @@ else:
35
  st.write("Failed to download the file.")
36
 
37
  # Carregar a biblioteca compartilhada usando ctypes
38
- lib = ctypes.CDLL(output_path)
39
-
40
- # Definir as funções que serão usadas
41
- Initial_Memory = lib.Initial_Memory
42
- Synapses_Active = lib.Synapses_Active
43
- ExecuteModel = lib.ExecuteModel
44
-
45
- # Tipos de argumentos e retorno das funções
46
- Initial_Memory.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p]
47
- Initial_Memory.restype = ctypes.c_void_p
 
48
 
49
- Synapses_Active.argtypes = [ctypes.c_char_p, ctypes.c_void_p]
50
- Synapses_Active.restype = ctypes.c_void_p
 
 
 
 
 
51
 
52
- ExecuteModel.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_void_p]
53
- ExecuteModel.restype = ctypes.c_char_p
 
 
 
 
 
 
 
54
 
55
  import keys as key
56
 
 
35
  st.write("Failed to download the file.")
36
 
37
  # Carregar a biblioteca compartilhada usando ctypes
38
+ try:
39
+ lib = ctypes.CDLL(output_path)
40
+
41
+ # Verificar e definir as funções
42
+ if hasattr(lib, 'Initial_Memory'):
43
+ Initial_Memory = lib.Initial_Memory
44
+ Initial_Memory.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p]
45
+ Initial_Memory.restype = ctypes.c_void_p
46
+ st.write("Initial_Memory function loaded successfully.")
47
+ else:
48
+ st.write("Initial_Memory function not found in the library.")
49
 
50
+ if hasattr(lib, 'Synapses_Active'):
51
+ Synapses_Active = lib.Synapses_Active
52
+ Synapses_Active.argtypes = [ctypes.c_char_p, ctypes.c_void_p]
53
+ Synapses_Active.restype = ctypes.c_void_p
54
+ st.write("Synapses_Active function loaded successfully.")
55
+ else:
56
+ st.write("Synapses_Active function not found in the library.")
57
 
58
+ if hasattr(lib, 'ExecuteModel'):
59
+ ExecuteModel = lib.ExecuteModel
60
+ ExecuteModel.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_void_p]
61
+ ExecuteModel.restype = ctypes.c_char_p
62
+ st.write("ExecuteModel function loaded successfully.")
63
+ else:
64
+ st.write("ExecuteModel function not found in the library.")
65
+ except Exception as e:
66
+ st.write(f"Error loading library: {e}")
67
 
68
  import keys as key
69