teste / app_install.py
AlineIoste's picture
Rename app.py to app_install.py
b678d85 verified
raw
history blame
1.18 kB
import os
import requests
import streamlit as st
def download_so():
url = "https://github.com/AlineIoste/teste/raw/main/SynapseControl.cpython-38-x86_64-linux-gnu.so"
current_dir = os.path.dirname(os.path.abspath(__file__))
output_path = os.path.join(current_dir, "SynapseControl.cpython-38-x86_64-linux-gnu.so")
# Verifique se o diretório existe, se não, crie-o
os.makedirs(os.path.dirname(output_path), exist_ok=True)
if not os.path.exists(output_path):
response = requests.get(url)
response.raise_for_status() # Para garantir que o download foi bem-sucedido
with open(output_path, 'wb') as f:
f.write(response.content)
st.write(f"Downloaded {url} to {output_path}")
else:
st.write(f"File already exists at {output_path}")
# Execute o download
download_so()
# Verifique se o arquivo foi baixado corretamente
current_dir = os.path.dirname(os.path.abspath(__file__))
output_path = os.path.join(current_dir, "SynapseControl.cpython-38-x86_64-linux-gnu.so")
if os.path.exists(output_path):
st.write("File downloaded successfully.")
else:
st.write("Failed to download the file.")