AlineIoste commited on
Commit
c515a76
verified
1 Parent(s): c74d391

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -32
app.py CHANGED
@@ -1,7 +1,8 @@
1
  import os
2
  import requests
3
- import ctypes
4
  import streamlit as st
 
 
5
 
6
  def download_so():
7
  url = "https://github.com/AlineIoste/teste/raw/main/SynapseControl.cpython-38-x86_64-linux-gnu.so"
@@ -34,39 +35,26 @@ if os.path.exists(output_path):
34
  else:
35
  st.write("Failed to download the file.")
36
 
37
- # Listar s铆mbolos da biblioteca
38
- import list_symbols
39
- symbols = list_symbols.list_symbols(output_path)
40
- st.write("Symbols in the library:")
41
- st.write(symbols)
42
 
43
- # Carregar a biblioteca compartilhada usando ctypes
44
  try:
45
- lib = ctypes.CDLL(output_path)
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- # Verificar e definir as fun莽玫es
48
- if hasattr(lib, 'Initial_Memory'):
49
- Initial_Memory = lib.Initial_Memory
50
- Initial_Memory.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p]
51
- Initial_Memory.restype = ctypes.c_void_p
52
- st.write("Initial_Memory function loaded successfully.")
53
- else:
54
- st.write("Initial_Memory function not found in the library.")
55
 
56
- if hasattr(lib, 'Synapses_Active'):
57
- Synapses_Active = lib.Synapses_Active
58
- Synapses_Active.argtypes = [ctypes.c_char_p, ctypes.c_void_p]
59
- Synapses_Active.restype = ctypes.c_void_p
60
- st.write("Synapses_Active function loaded successfully.")
61
- else:
62
- st.write("Synapses_Active function not found in the library.")
63
 
64
- if hasattr(lib, 'ExecuteModel'):
65
- ExecuteModel = lib.ExecuteModel
66
- ExecuteModel.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_void_p]
67
- ExecuteModel.restype = ctypes.c_char_p
68
- st.write("ExecuteModel function loaded successfully.")
69
- else:
70
- st.write("ExecuteModel function not found in the library.")
71
- except Exception as e:
72
- st.write(f"Error loading library: {e}")
 
1
  import os
2
  import requests
 
3
  import streamlit as st
4
+ import importlib.util
5
+ import sys
6
 
7
  def download_so():
8
  url = "https://github.com/AlineIoste/teste/raw/main/SynapseControl.cpython-38-x86_64-linux-gnu.so"
 
35
  else:
36
  st.write("Failed to download the file.")
37
 
38
+ # Adicionar o diret贸rio atual ao sys.path
39
+ sys.path.append(current_dir)
 
 
 
40
 
41
+ # Importar o m贸dulo SynapseControl
42
  try:
43
+ import SynapseControl
44
+ st.write("SynapseControl module loaded successfully.")
45
+
46
+ # Verificar a exist锚ncia das fun莽玫es
47
+ functions = ["Initial_Memory", "Synapses_Active", "ExecuteModel"]
48
+ for func in functions:
49
+ if hasattr(SynapseControl, func):
50
+ st.write(f"{func} function is available.")
51
+ else:
52
+ st.write(f"{func} function is not found in the module.")
53
+ except Exception as e:
54
+ st.write(f"Error loading SynapseControl module: {e}")
55
 
56
+ # Continue com o restante da l贸gica do seu aplicativo Streamlit
 
 
 
 
 
 
 
57
 
58
+ import keys as key
 
 
 
 
 
 
59
 
60
+ st.title("Neurocognitive Structures")