Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,6 @@ def invoke(openai_api_key, use_rag, prompt):
|
|
44 |
if (os.path.isdir(CHROMA_DIR)):
|
45 |
vector_db = Chroma(embedding_function = OpenAIEmbeddings(),
|
46 |
persist_directory = CHROMA_DIR)
|
47 |
-
print("2 Load DB")
|
48 |
else:
|
49 |
loader = GenericLoader(YoutubeAudioLoader([YOUTUBE_URL], YOUTUBE_DIR),
|
50 |
OpenAIWhisperParser())
|
@@ -55,7 +54,6 @@ def invoke(openai_api_key, use_rag, prompt):
|
|
55 |
vector_db = Chroma.from_documents(documents = splits,
|
56 |
embedding = OpenAIEmbeddings(),
|
57 |
persist_directory = CHROMA_DIR)
|
58 |
-
print("1 Create DB")
|
59 |
rag_chain = RetrievalQA.from_chain_type(llm,
|
60 |
chain_type_kwargs = {"prompt": RAG_CHAIN_PROMPT},
|
61 |
retriever = vector_db.as_retriever(search_kwargs = {"k": 3}),
|
@@ -77,8 +75,6 @@ description = """<strong>Overview:</strong> The app demonstrates how to use a La
|
|
77 |
<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>
|
78 |
<li>Experiment with different prompts, for example "explain gpt-4 in german", "list pros and cons of gpt-4", or "write a poem about gpt-4".</li>
|
79 |
</ul>
|
80 |
-
In a production system, embedding external data is done in a batch process. An idea for a production system is to perform LLM use cases on the
|
81 |
-
<a href='https://www.youtube.com/playlist?list=PL2yQDdvlhXf_hIzmfHCdbcXj2hS52oP9r'>AWS re:Invent playlist</a> (stand by).\n\n
|
82 |
<strong>Technology:</strong> <a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://platform.openai.com/'>OpenAI</a> API via AI-first
|
83 |
<a href='https://www.langchain.com/'>LangChain</a> toolkit with <a href='https://openai.com/research/whisper'>Whisper</a> (speech-to-text) and
|
84 |
<a href='https://openai.com/research/gpt-4'>GPT-4</a> (LLM) foundation models as well as AI-native <a href='https://www.trychroma.com/'>Chroma</a>
|
|
|
44 |
if (os.path.isdir(CHROMA_DIR)):
|
45 |
vector_db = Chroma(embedding_function = OpenAIEmbeddings(),
|
46 |
persist_directory = CHROMA_DIR)
|
|
|
47 |
else:
|
48 |
loader = GenericLoader(YoutubeAudioLoader([YOUTUBE_URL], YOUTUBE_DIR),
|
49 |
OpenAIWhisperParser())
|
|
|
54 |
vector_db = Chroma.from_documents(documents = splits,
|
55 |
embedding = OpenAIEmbeddings(),
|
56 |
persist_directory = CHROMA_DIR)
|
|
|
57 |
rag_chain = RetrievalQA.from_chain_type(llm,
|
58 |
chain_type_kwargs = {"prompt": RAG_CHAIN_PROMPT},
|
59 |
retriever = vector_db.as_retriever(search_kwargs = {"k": 3}),
|
|
|
75 |
<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>
|
76 |
<li>Experiment with different prompts, for example "explain gpt-4 in german", "list pros and cons of gpt-4", or "write a poem about gpt-4".</li>
|
77 |
</ul>
|
|
|
|
|
78 |
<strong>Technology:</strong> <a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://platform.openai.com/'>OpenAI</a> API via AI-first
|
79 |
<a href='https://www.langchain.com/'>LangChain</a> toolkit with <a href='https://openai.com/research/whisper'>Whisper</a> (speech-to-text) and
|
80 |
<a href='https://openai.com/research/gpt-4'>GPT-4</a> (LLM) foundation models as well as AI-native <a href='https://www.trychroma.com/'>Chroma</a>
|