Spaces:
Running
Running
Delete share_app.py
Browse files- share_app.py +0 -37
share_app.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import time
|
| 3 |
-
import threading
|
| 4 |
-
from pyngrok import ngrok
|
| 5 |
-
|
| 6 |
-
def run_streamlit():
|
| 7 |
-
os.system("python3 -m streamlit run app.py")
|
| 8 |
-
|
| 9 |
-
def start_ngrok():
|
| 10 |
-
print("Starting Streamlit app...")
|
| 11 |
-
# Give streamlit a moment to start
|
| 12 |
-
time.sleep(5)
|
| 13 |
-
|
| 14 |
-
try:
|
| 15 |
-
# Open a HTTP tunnel on the default port 8501
|
| 16 |
-
public_url = ngrok.connect(8501).public_url
|
| 17 |
-
print("\n" + "="*60)
|
| 18 |
-
print(f" \033[92m>>> YOUR LIVE LINK: {public_url} <<<\033[0m")
|
| 19 |
-
print(" Share this link with your client. The app must stay running.")
|
| 20 |
-
print("="*60 + "\n")
|
| 21 |
-
|
| 22 |
-
# Keep the script running
|
| 23 |
-
input("Press Enter to exit...\n")
|
| 24 |
-
except Exception as e:
|
| 25 |
-
print(f"\nError starting ngrok: {e}")
|
| 26 |
-
print("\nNOTE: You may need a free ngrok account.")
|
| 27 |
-
print("1. Go to https://dashboard.ngrok.com/signup")
|
| 28 |
-
print("2. Get your Authtoken")
|
| 29 |
-
print("3. Run: ngrok config add-authtoken <your_token>")
|
| 30 |
-
|
| 31 |
-
if __name__ == "__main__":
|
| 32 |
-
# Start Streamlit in a separate thread
|
| 33 |
-
thread = threading.Thread(target=run_streamlit)
|
| 34 |
-
thread.daemon = True
|
| 35 |
-
thread.start()
|
| 36 |
-
|
| 37 |
-
start_ngrok()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|