Spaces:
Sleeping
Sleeping
import streamlit as st | |
from selenium import webdriver | |
# import chromedriver_binary | |
from time import sleep | |
import subprocess | |
st.title("Try") | |
st.text("running commondsd .....") | |
script_path = 'render-build.sh' | |
subprocess.run(['sh', script_path], check=True) | |
# subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
cmd1 = subprocess.run("apt update", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
if cmd1.returncode == 0: | |
print("Command output:") | |
print(cmd1.stdout) | |
else: | |
# Print the error message | |
print("Error executing command:") | |
print(cmd1.stderr) | |
sleep(5) | |
cmd2 = subprocess.run("apt-get install -y libglib2.0-0=2.50.3-2", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
if cmd2.returncode == 0: | |
print("Command output:") | |
print(cmd2.stdout) | |
else: | |
# Print the error message | |
print("Error executing command:") | |
print(cmd2.stderr) | |
sleep(5) | |
cmd3 = subprocess.run("apt-get install -y chromium-browser", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
if cmd3.returncode == 0: | |
print("Command output:") | |
print(cmd3.stdout) | |
else: | |
# Print the error message | |
print("Error executing command:") | |
print(cmd3.stderr) | |
sleep(5) | |
cmd4 = subprocess.run("apt-get install -y chromium", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
if cmd4.returncode == 0: | |
print("Command output:") | |
print(cmd4.stdout) | |
else: | |
# Print the error message | |
print("Error executing command:") | |
print(cmd4.stderr) | |
sleep(5) | |
cmd5 = subprocess.run("apt-get install -y libfontconfig1 libnss3", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
if cmd5.returncode == 0: | |
print("Command output:") | |
print(cmd5.stdout) | |
else: | |
# Print the error message | |
print("Error executing command:") | |
print(cmd5.stderr) | |
sleep(5) | |
st.text("done") | |
st.text("chrome") | |
driver = webdriver.Chrome() | |
# def open_website(url): | |
# driver = webdriver.Chrome() # Initialize Chrome WebDriver | |
# driver.get(url) # Open the URL in Chrome | |
# assert "Python" in driver.title | |
# def main(): | |
# st.title("Website Opener") | |
# st.write("Click the button below to open a website.") | |
# website_url = st.text_input("Enter website URL:", "https://google.com") | |
# if st.button("Open Website"): | |
# open_website(website_url) | |
# if __name__ == "__main__": | |
# main() | |