Spaces:
Sleeping
Sleeping
Dy
commited on
Commit
•
60b0ed5
1
Parent(s):
067f5df
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ from langchain.llms import OpenAI
|
|
10 |
OPENAI_API_KEY = os.environ['OPENAI_API_KEY']
|
11 |
|
12 |
previous_youtube_url = None
|
|
|
13 |
|
14 |
def get_video_id(url):
|
15 |
video_id = None
|
@@ -42,8 +43,10 @@ def answer_question(youtube_url, user_question):
|
|
42 |
# You can implement your logic here to process the video, transcribe it, and answer the user question.
|
43 |
# For now, let's return the user question as output.
|
44 |
global previous_youtube_url
|
|
|
|
|
45 |
if previous_youtube_url == youtube_url:
|
46 |
-
index = VectorstoreIndexCreator().from_loaders([loader])
|
47 |
query = user_question
|
48 |
answer = index.query(llm=OpenAI(model="text-davinci-003"), question = query)
|
49 |
else:
|
|
|
10 |
OPENAI_API_KEY = os.environ['OPENAI_API_KEY']
|
11 |
|
12 |
previous_youtube_url = None
|
13 |
+
index = None
|
14 |
|
15 |
def get_video_id(url):
|
16 |
video_id = None
|
|
|
43 |
# You can implement your logic here to process the video, transcribe it, and answer the user question.
|
44 |
# For now, let's return the user question as output.
|
45 |
global previous_youtube_url
|
46 |
+
global index
|
47 |
+
|
48 |
if previous_youtube_url == youtube_url:
|
49 |
+
#index = VectorstoreIndexCreator().from_loaders([loader])
|
50 |
query = user_question
|
51 |
answer = index.query(llm=OpenAI(model="text-davinci-003"), question = query)
|
52 |
else:
|