SandyBot commited on
Commit
89413bc
·
verified ·
1 Parent(s): 6e6c7fe

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -37
app.py DELETED
@@ -1,37 +0,0 @@
1
- import streamlit as st
2
- from rag_chain import get_rag_chain
3
-
4
- st.set_page_config(page_title="Cricket Chat", page_icon="🏏")
5
- st.title("YouTube Video Chatbot")
6
-
7
- video_id = st.text_input("Enter YouTube video ID (e.g. Gfr50f6ZBvo)")
8
-
9
- if video_id and st.session_state.get("current_video") != video_id:
10
- with st.spinner("Processing transcript..."):
11
- try:
12
- st.session_state.chain = get_rag_chain(video_id)
13
- st.session_state.current_video = video_id
14
- st.session_state.messages = []
15
- st.success("Ready! Ask away.")
16
- except ValueError as e:
17
- st.error(str(e))
18
- st.stop()
19
-
20
- if "messages" not in st.session_state:
21
- st.session_state.messages = []
22
-
23
- for msg in st.session_state.messages:
24
- with st.chat_message(msg["role"]):
25
- st.markdown(msg["content"])
26
-
27
- if "chain" in st.session_state:
28
- if prompt := st.chat_input("Ask about the video..."):
29
- st.session_state.messages.append({"role": "user", "content": prompt})
30
- with st.chat_message("user"):
31
- st.markdown(prompt)
32
-
33
- with st.chat_message("assistant"):
34
- with st.spinner("Thinking..."):
35
- response = st.session_state.chain.invoke(prompt)
36
- st.markdown(response)
37
- st.session_state.messages.append({"role": "assistant", "content": response})