Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ st.markdown(DESCRIPTION)
|
|
36 |
def get_video_title(youtube_url: str) -> str:
|
37 |
yt = YouTube(youtube_url)
|
38 |
embed_url = f"https://www.youtube.com/embed/{yt.video_id}"
|
39 |
-
embed_html = f'<iframe
|
40 |
return yt.title, embed_html
|
41 |
|
42 |
|
@@ -152,7 +152,7 @@ if st.session_state.youtube_url and not st.session_state.setup_done:
|
|
152 |
retriever.search_kwargs['k'] = 4
|
153 |
with st.status("Running RetrievalQA..."):
|
154 |
llama_instance = LlamaLLM()
|
155 |
-
st.session_state.qa = RetrievalQA.from_chain_type(llm=llama_instance, chain_type="stuff", retriever=retriever,
|
156 |
|
157 |
st.session_state.doneYoutubeurl = st.session_state.youtube_url
|
158 |
st.session_state.setup_done = True # Mark the setup as done for this URL
|
@@ -170,9 +170,8 @@ if prompt := textinput:
|
|
170 |
st.chat_message("human",avatar = "🧑💻").markdown(prompt)
|
171 |
st.session_state.messages.append({"role": "human", "content": prompt})
|
172 |
with st.status("Requesting Client..."):
|
173 |
-
response = st.session_state.qa(
|
174 |
-
{"query": prompt})
|
175 |
with st.chat_message("assistant", avatar='🦙'):
|
176 |
-
st.markdown(
|
177 |
# Add assistant response to chat history
|
178 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
36 |
def get_video_title(youtube_url: str) -> str:
|
37 |
yt = YouTube(youtube_url)
|
38 |
embed_url = f"https://www.youtube.com/embed/{yt.video_id}"
|
39 |
+
embed_html = f'<iframe src="{embed_url}" frameborder="0" allowfullscreen></iframe>'
|
40 |
return yt.title, embed_html
|
41 |
|
42 |
|
|
|
152 |
retriever.search_kwargs['k'] = 4
|
153 |
with st.status("Running RetrievalQA..."):
|
154 |
llama_instance = LlamaLLM()
|
155 |
+
st.session_state.qa = RetrievalQA.from_chain_type(llm=llama_instance, chain_type="stuff", retriever=retriever,chain_type_kwargs={"prompt": prompt})
|
156 |
|
157 |
st.session_state.doneYoutubeurl = st.session_state.youtube_url
|
158 |
st.session_state.setup_done = True # Mark the setup as done for this URL
|
|
|
170 |
st.chat_message("human",avatar = "🧑💻").markdown(prompt)
|
171 |
st.session_state.messages.append({"role": "human", "content": prompt})
|
172 |
with st.status("Requesting Client..."):
|
173 |
+
response = st.session_state.qa.run(prompt)
|
|
|
174 |
with st.chat_message("assistant", avatar='🦙'):
|
175 |
+
st.markdown(response)
|
176 |
# Add assistant response to chat history
|
177 |
st.session_state.messages.append({"role": "assistant", "content": response})
|