Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -46,12 +46,12 @@ def invoke(openai_api_key, use_rag, prompt):
|
|
46 |
temperature = 0)
|
47 |
if (use_rag):
|
48 |
# Document loading, splitting, and storage
|
49 |
-
loader = GenericLoader(YoutubeAudioLoader([
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
OpenAIWhisperParser())
|
56 |
docs = loader.load()
|
57 |
text_splitter = RecursiveCharacterTextSplitter(chunk_overlap = 150,
|
@@ -75,8 +75,8 @@ def invoke(openai_api_key, use_rag, prompt):
|
|
75 |
return result
|
76 |
|
77 |
description = """<strong>Overview:</strong> The app demonstrates how to use a Large Language Model (LLM) with Retrieval Augmented Generation (RAG) on external data
|
78 |
-
(in this case YouTube videos
|
79 |
-
<strong>Instructions:</strong> Enter an OpenAI API key and perform LLM use cases (semantic search, sentiment analysis, summarization, translation, etc.)
|
80 |
<ul style="list-style-type:square;">
|
81 |
<li>Set "Retrieval Augmented Generation" to "<strong>False</strong>" and submit prompt "explain gpt-4". The LLM <strong>without</strong> RAG does not know the answer.</li>
|
82 |
<li>Set "Retrieval Augmented Generation" to "<strong>True</strong>" and submit prompt "explain gpt-4". The LLM <strong>with</strong> RAG knows the answer.</li>
|
|
|
46 |
temperature = 0)
|
47 |
if (use_rag):
|
48 |
# Document loading, splitting, and storage
|
49 |
+
loader = GenericLoader(YoutubeAudioLoader([YOUTUBE_URL_1,
|
50 |
+
YOUTUBE_URL_2,
|
51 |
+
YOUTUBE_URL_3,
|
52 |
+
YOUTUBE_URL_4,
|
53 |
+
YOUTUBE_URL_5,
|
54 |
+
YOUTUBE_URL_6], YOUTUBE_DIR),
|
55 |
OpenAIWhisperParser())
|
56 |
docs = loader.load()
|
57 |
text_splitter = RecursiveCharacterTextSplitter(chunk_overlap = 150,
|
|
|
75 |
return result
|
76 |
|
77 |
description = """<strong>Overview:</strong> The app demonstrates how to use a Large Language Model (LLM) with Retrieval Augmented Generation (RAG) on external data
|
78 |
+
(in this case YouTube videos, but it could be PDFs, URLs, or other <a href='https://raw.githubusercontent.com/bstraehle/ai-ml-dl/c38b224c196fc984aab6b6cc6bdc666f8f4fbcff/langchain/document-loaders.png'>data sources</a>).\n\n
|
79 |
+
<strong>Instructions:</strong> Enter an OpenAI API key and perform LLM use cases (semantic search, sentiment analysis, summarization, translation, etc.) on YouTube videos about GPT-4.
|
80 |
<ul style="list-style-type:square;">
|
81 |
<li>Set "Retrieval Augmented Generation" to "<strong>False</strong>" and submit prompt "explain gpt-4". The LLM <strong>without</strong> RAG does not know the answer.</li>
|
82 |
<li>Set "Retrieval Augmented Generation" to "<strong>True</strong>" and submit prompt "explain gpt-4". The LLM <strong>with</strong> RAG knows the answer.</li>
|