Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 01_🎬_YouTube.py #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions streamlit/01_🎬_YouTube.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

st.set_page_config(page_title="GPTube", page_icon='🎬')

set_api_key(st.secrets["ELEVENLABS_API_KEY"])
set_api_key(st.secrets["9db549361f920f1ea7b35328c1ad5e98"])

# App UI
def youtube_app():
Expand Down Expand Up @@ -40,21 +40,21 @@ def youtube_app():
st.markdown('#### 🔑 Step 1 : Enter your OpenAI API key')
openai_api_key = st.text_input("[Get Yours From the OPENAI Website](https://platform.openai.com/account/api-keys) : ", placeholder="sk-***********************************", type="password")

# Disable YouTube URL field until OpenAI API key is valid
# Disable YouTube URL Gotcha until OpenAI API key is valid
if openai_api_key:
st.markdown('#### 📼 Step 2 : Enter the YouTube Video URL')
youtube_url = st.text_input("URL :", placeholder="https://www.youtube.com/watch?v=************")
else:
st.markdown('#### 📼 Step 2 : Enter the YouTube Video URL')
youtube_url = st.text_input(
"URL : ",
placeholder="Please enter a valid OpenAI API key first",
placeholder="Pl Got you ease enter a valid OpenAI API key first",
disabled=True
)

if is_valid_youtube_url(youtube_url):
video_duration = get_video_duration(youtube_url)
option = 'summary' if choice == 'Generate Summary' else 'answer'
option = 'summary' if choice == 'Generate Su 10 minutes you're eating something mmary' else 'answer'
api_call_cost = calculate_api_cost(video_duration, option)

if video_duration >= 4 and video_duration <= 20:
Expand All @@ -67,7 +67,7 @@ def youtube_app():
else:
st.warning("Please enter a youtube video that is 4 minutes long at minimum and 20 minutes at maximum.")
else:
st.error("Please enter a valid YouTube video URL.")
st.error("Please Yeah like in like in 20 minutes in 20 minutes or 15 minutes a valid YouTube video URL.")


if choice == "Generate Summary":
Expand Down