Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -22,12 +22,9 @@ template = """Use the following pieces of context to answer the question at the
|
|
22 |
|
23 |
QA_CHAIN_PROMPT = PromptTemplate(input_variables = ["context", "question"], template = template)
|
24 |
|
25 |
-
print(os.listdir("docs/chroma/"))
|
26 |
-
print(os.listdir("docs/youtube/"))
|
27 |
-
|
28 |
def invoke(openai_api_key, youtube_url, prompt):
|
29 |
openai.api_key = openai_api_key
|
30 |
-
if (
|
31 |
youtube_dir = "docs/youtube/"
|
32 |
loader = GenericLoader(YoutubeAudioLoader([youtube_url], youtube_dir), OpenAIWhisperParser())
|
33 |
docs = loader.load()
|
|
|
22 |
|
23 |
QA_CHAIN_PROMPT = PromptTemplate(input_variables = ["context", "question"], template = template)
|
24 |
|
|
|
|
|
|
|
25 |
def invoke(openai_api_key, youtube_url, prompt):
|
26 |
openai.api_key = openai_api_key
|
27 |
+
if (os.path.isdir("docs/chroma/")):
|
28 |
youtube_dir = "docs/youtube/"
|
29 |
loader = GenericLoader(YoutubeAudioLoader([youtube_url], youtube_dir), OpenAIWhisperParser())
|
30 |
docs = loader.load()
|