Spaces:
Sleeping
Sleeping
Dy
commited on
Commit
•
bb1eb3a
1
Parent(s):
60b0ed5
Update app.py
Browse files
app.py
CHANGED
@@ -44,10 +44,15 @@ def answer_question(youtube_url, 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:
|
53 |
f= open("temp.txt","w+")
|
@@ -58,7 +63,7 @@ def answer_question(youtube_url, user_question):
|
|
58 |
index = VectorstoreIndexCreator().from_loaders([loader])
|
59 |
os.remove("temp.txt")
|
60 |
|
61 |
-
query = user_question
|
62 |
answer = index.query(llm=OpenAI(model="text-davinci-003"), question = query)
|
63 |
|
64 |
return answer
|
|
|
44 |
# For now, let's return the user question as output.
|
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
|