Back to Videolingo

Welcome to VideoLingo! ๐ŸŽ‰๐Ÿš€

VideoLingo_colab.ipynb

3.0.12.7 KB
Original Source

Welcome to VideoLingo! ๐ŸŽ‰๐Ÿš€

This colab file allows you to quickly experience the full functionality in just 5 minutes! โฑ๏ธโœจ Before you begin, you may need to prepare some keys. ๐Ÿ”‘๐Ÿ—๏ธ Please read https://videolingo.io/docs/start to get ready. ๐Ÿ“š๐Ÿ‘

*Please use a T4 GPU to execute this colab for optimal performance.

1. Clone VideoLingo repo ๐Ÿ“ฅ

python
!git clone https://github.com/Huanshere/VideoLingo.git
%cd VideoLingo

2. Installation ๐Ÿš€

this takes around 4 mins

python
!python install.py

3. Register and Obtain Ngrok Token ๐Ÿ”‘

  1. Visit the Ngrok official website and register for an account.
  2. After logging in, find the "Your Authtoken" section on the dashboard page, or directly visit Ngrok Token.
  3. Copy your Ngrok Authtoken.

After completing these steps, please fill in your ngrok token in the next section of code and proceed.


3. ๆณจๅ†Œๅนถ่Žทๅ– Ngrok ไปค็‰Œ ๐Ÿ”‘

  1. ่ฎฟ้—ฎ Ngrok ๅฎ˜ๆ–น็ฝ‘็ซ™ ๅนถๆณจๅ†Œ่ดฆๆˆทใ€‚
  2. ็™ปๅฝ•ๅŽ๏ผŒๅœจไปช่กจๆฟ้กต้ขๆ‰พๅˆฐ"Your Authtoken"้ƒจๅˆ†๏ผŒๆˆ–็›ดๆŽฅ่ฎฟ้—ฎ Ngrok ไปค็‰Œใ€‚
  3. ๅคๅˆถๆ‚จ็š„ Ngrok Authtokenใ€‚

ๅฎŒๆˆ่ฟ™ไบ›ๆญฅ้ชคๅŽ๏ผŒ่ฏทๅœจไธ‹ไธ€่Š‚ไปฃ็ ไธญๅกซๅ…ฅๆ‚จ็š„ ngrok ไปค็‰Œๅนถ็ปง็ปญใ€‚

python
!pip install pyngrok
from pyngrok import ngrok

#! SET Ngrok Authtoken Here
ngrok.set_auth_token("YOUR_TOKEN_HERE")

๐ŸŽˆ 4. Streamlit GO !!!

Click the NgrokChannel URL to start your VideoLingo Journey.

tips: You can set your Language down the sidebar on the left.

python
import subprocess
import threading
import sys
from pyngrok import ngrok
from rich import print as rprint
from rich.panel import Panel

def print_output(process):
    for line in iter(process.stdout.readline, ''):
        sys.stdout.write(line)
    for line in iter(process.stderr.readline, ''):
        sys.stderr.write(line)

# Start Streamlit
streamlit_process = subprocess.Popen(
    ["streamlit", "run", "st.py"],
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    universal_newlines=True,
    bufsize=1
)

# Create and start the output printing thread
output_thread = threading.Thread(target=print_output, args=(streamlit_process,))
output_thread.start()

# Create a tunnel using ngrok
public_url = ngrok.connect(8501)
rprint(Panel(f"Streamlit is available at Ngrok โฌ‡๏ธ", expand=False))
print(f"Click ๐Ÿ‘‰ {public_url}")

# Keep the program running
ngrok_process = ngrok.get_ngrok_process()
try:
    streamlit_process.wait()
except KeyboardInterrupt:
    print("Interrupted by user, shutting down...")
finally:
    ngrok.kill()
    streamlit_process.terminate()
    output_thread.join()