Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,16 @@
|
|
1 |
-
import
|
2 |
import subprocess
|
3 |
-
import
|
|
|
|
|
|
|
4 |
|
5 |
-
#
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
st.markdown("### Installing requirements from `requirements.txt`...")
|
11 |
-
with st.spinner("Installing dependencies..."):
|
12 |
-
try:
|
13 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
|
14 |
-
st.success("Requirements installed successfully.")
|
15 |
-
except subprocess.CalledProcessError as e:
|
16 |
-
st.error(f"Failed to install requirements: {e}")
|
17 |
-
st.stop() # Stop further execution if installation fails
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
try:
|
23 |
-
result = subprocess.run(
|
24 |
-
[sys.executable, "-m", "Powers"], # Running python3 -m powers
|
25 |
-
stdout=subprocess.PIPE,
|
26 |
-
stderr=subprocess.PIPE,
|
27 |
-
text=True
|
28 |
-
)
|
29 |
-
# Display bot logs (stdout and stderr)
|
30 |
-
st.code(result.stdout + result.stderr, language='bash')
|
31 |
-
except Exception as e:
|
32 |
-
st.error(f"Failed to start the bot: {e}")
|
|
|
1 |
+
import os
|
2 |
import subprocess
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
# Set up the environment (if needed)
|
6 |
+
os.environ["PYTHONUNBUFFERED"] = "1"
|
7 |
|
8 |
+
# Run the Gojo_Satoru bot from Powers module
|
9 |
+
def run_bot():
|
10 |
+
subprocess.run(["python3", "-m", "Powers"])
|
11 |
|
12 |
+
st.title("Telegram Bot")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
if st.button("Start flash Bot"):
|
15 |
+
run_bot()
|
16 |
+
st.success("flash Bot is running!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|