Skip to content

Commit

Permalink
Use streamlit compute
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitgr7 committed Mar 4, 2023
1 parent 72fa1f5 commit 8dc2129
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess
from pathlib import Path

import requests
Expand All @@ -11,6 +12,11 @@
stage = 1


@st.cache_data(show_spinner=False, ttl=None)
def _start_server():
subprocess.call("uvicorn backend.main:app --host 0.0.0.0 --port 8000 &", shell=True)


def _display_input_type():
file_type = st.selectbox(label="File type", options=["<select>", "Audio", "YT Video", "Existing Sample"])
return file_type
Expand Down Expand Up @@ -41,7 +47,7 @@ def _audio_upload():
return None


@st.cache(show_spinner=False, ttl=3600 * 6)
@st.cache_data(show_spinner=False, ttl=3600 * 6)
def _download_video(yt_link):
return download_video(yt_link)

Expand All @@ -67,7 +73,7 @@ def _video_link_upload():
return None


@st.cache(show_spinner=False, ttl=3600 * 6)
@st.cache_data(show_spinner=False, ttl=3600 * 6)
def _whisper_recognize(url, media_path, file_type):
if file_type in ("YT Video", "Existing Sample"):
audio_path = extract_audio_from_video(media_path)
Expand Down Expand Up @@ -106,6 +112,7 @@ def _display_media_at_timestamp(media_bytes, timestamp, media_type, st_obj):


def _main():
_start_server()
global stage

file_type = None
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
streamlit==1.17.0
-r requirements/backend.txt
streamlit==1.19.0
yt-dlp==2023.1.6
moviepy==1.0.3
pydub==0.25.1

0 comments on commit 8dc2129

Please sign in to comment.