AlineIoste commited on
Commit
dcb405d
verified
1 Parent(s): 92d5626

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +42 -3
app2.py CHANGED
@@ -1,10 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import sys
2
  import os
3
  import streamlit as st
4
  import inspect
5
- # Baixar a biblioteca compartilhada
6
- import download_so
7
- from SynapseControl import Initial_Memory, Synapses_Active, ExecuteModel
8
  import keys as key
9
 
10
  st.title("Neurocognitive Structures")
 
1
+ import os
2
+ import requests
3
+ import streamlit as st
4
+
5
+ def download_so():
6
+ url = "https://github.com/AlineIoste/teste/raw/main/SynapseControl.cpython-38-x86_64-linux-gnu.so"
7
+ current_dir = os.path.dirname(os.path.abspath(__file__))
8
+ output_path = os.path.join(current_dir, "SynapseControl.cpython-38-x86_64-linux-gnu.so")
9
+
10
+ # Verifique se o diret贸rio existe, se n茫o, crie-o
11
+ os.makedirs(os.path.dirname(output_path), exist_ok=True)
12
+
13
+ if not os.path.exists(output_path):
14
+ response = requests.get(url)
15
+ response.raise_for_status() # Para garantir que o download foi bem-sucedido
16
+
17
+ with open(output_path, 'wb') as f:
18
+ f.write(response.content)
19
+
20
+ st.write(f"Downloaded {url} to {output_path}")
21
+ else:
22
+ st.write(f"File already exists at {output_path}")
23
+
24
+ # Execute o download
25
+ download_so()
26
+
27
+ # Verifique se o arquivo foi baixado corretamente
28
+ current_dir = os.path.dirname(os.path.abspath(__file__))
29
+ output_path = os.path.join(current_dir, "SynapseControl.cpython-38-x86_64-linux-gnu.so")
30
+
31
+ if os.path.exists(output_path):
32
+ st.write("File downloaded successfully.")
33
+ else:
34
+ st.write("Failed to download the file.")
35
+
36
+ # Importar a biblioteca baixada
37
+ import sys
38
+ sys.path.append(current_dir)
39
+ from SynapseControl import Initial_Memory, Synapses_Active, ExecuteModel
40
+
41
+
42
+
43
  import sys
44
  import os
45
  import streamlit as st
46
  import inspect
 
 
 
47
  import keys as key
48
 
49
  st.title("Neurocognitive Structures")