Dragdev commited on
Commit
c01079c
·
verified ·
1 Parent(s): d11af41

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import subprocess
3
+ import sys
4
+ import os
5
+
6
+ st.set_page_config(page_title="Gojo Satoru Bot", layout="centered")
7
+ st.title("Gojo Satoru Telegram Bot")
8
+
9
+ st.markdown("### Installing requirements.txt ...")
10
+ with st.spinner("Installing..."):
11
+ try:
12
+ # Install packages
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()
18
+
19
+ st.markdown("### Running `python -m powers` ...")
20
+ with st.spinner("Launching bot..."):
21
+ try:
22
+ result = subprocess.run(
23
+ [sys.executable, "-m", "powers"],
24
+ stdout=subprocess.PIPE,
25
+ stderr=subprocess.PIPE,
26
+ text=True
27
+ )
28
+ st.code(result.stdout + result.stderr, language='bash')
29
+ except Exception as e:
30
+ st.error(f"Failed to start the bot: {e}")