Spaces:
Sleeping
Sleeping
Dy
commited on
Commit
•
84270c1
1
Parent(s):
fed2792
Update app.py
Browse files
app.py
CHANGED
@@ -45,14 +45,14 @@ def answer_question(youtube_url, user_question):
|
|
45 |
global previous_youtube_url
|
46 |
global index
|
47 |
|
48 |
-
query = '''
|
49 |
-
You are an expert researcher that can answer any questions from a given text. Here is the question:
|
50 |
-
{}
|
51 |
-
'''.format(str(user_question))
|
52 |
-
|
53 |
if previous_youtube_url == youtube_url:
|
54 |
#index = VectorstoreIndexCreator().from_loaders([loader])
|
55 |
-
|
56 |
answer = index.query(llm=OpenAI(model="text-davinci-003"), question = query)
|
57 |
else:
|
58 |
f= open("temp.txt","w+")
|
@@ -63,7 +63,7 @@ def answer_question(youtube_url, user_question):
|
|
63 |
index = VectorstoreIndexCreator().from_loaders([loader])
|
64 |
os.remove("temp.txt")
|
65 |
|
66 |
-
|
67 |
answer = index.query(llm=OpenAI(model="text-davinci-003"), question = query)
|
68 |
|
69 |
return answer
|
|
|
45 |
global previous_youtube_url
|
46 |
global index
|
47 |
|
48 |
+
#query = '''
|
49 |
+
#You are an expert researcher that can answer any questions from a given text. Here is the question:
|
50 |
+
#{}
|
51 |
+
#'''.format(str(user_question))
|
52 |
+
|
53 |
if previous_youtube_url == youtube_url:
|
54 |
#index = VectorstoreIndexCreator().from_loaders([loader])
|
55 |
+
query = user_question
|
56 |
answer = index.query(llm=OpenAI(model="text-davinci-003"), question = query)
|
57 |
else:
|
58 |
f= open("temp.txt","w+")
|
|
|
63 |
index = VectorstoreIndexCreator().from_loaders([loader])
|
64 |
os.remove("temp.txt")
|
65 |
|
66 |
+
query = user_question
|
67 |
answer = index.query(llm=OpenAI(model="text-davinci-003"), question = query)
|
68 |
|
69 |
return answer
|