telegrambot / app.py
Dragdev's picture
Create app.py
c01079c verified
raw
history blame
989 Bytes
import streamlit as st
import subprocess
import sys
import os
st.set_page_config(page_title="Gojo Satoru Bot", layout="centered")
st.title("Gojo Satoru Telegram Bot")
st.markdown("### Installing requirements.txt ...")
with st.spinner("Installing..."):
try:
# Install packages
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
st.success("Requirements installed successfully.")
except subprocess.CalledProcessError as e:
st.error(f"Failed to install requirements: {e}")
st.stop()
st.markdown("### Running `python -m powers` ...")
with st.spinner("Launching bot..."):
try:
result = subprocess.run(
[sys.executable, "-m", "powers"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
st.code(result.stdout + result.stderr, language='bash')
except Exception as e:
st.error(f"Failed to start the bot: {e}")