Spaces:
Runtime error
Runtime error
Update app.py (#1)
Browse files- Update app.py (a0642c19c4cf05b887b8b9b2b1dd54da6c42354c)
Co-authored-by: Yueyang Wang <[email protected]>
app.py
CHANGED
@@ -56,7 +56,7 @@ def save_uploaded_file(uploaded_file):
|
|
56 |
|
57 |
def summarize_pdf(pdf_file_path, num_clusters=10):
|
58 |
embeddings_model = OpenAIEmbeddings(model="text-embedding-3-small", api_key=openai_api_key)
|
59 |
-
llm = ChatOpenAI(model="gpt-
|
60 |
prompt = ChatPromptTemplate.from_template(
|
61 |
"""Could you please provide a concise and comprehensive summary of the given Contexts?
|
62 |
The summary should capture the main points and key details of the text while conveying the author's intended meaning accurately.
|
@@ -89,7 +89,7 @@ def summarize_pdf(pdf_file_path, num_clusters=10):
|
|
89 |
|
90 |
def qa_pdf(pdf_file_path, query, num_clusters=5, similarity_threshold=0.6):
|
91 |
embeddings_model = OpenAIEmbeddings(model="text-embedding-3-small", api_key=openai_api_key)
|
92 |
-
llm = ChatOpenAI(model="gpt-
|
93 |
prompt = ChatPromptTemplate.from_template(
|
94 |
"""Please provide a detailed and accurate answer to the given question based on the provided contexts.
|
95 |
Ensure that the answer is comprehensive and directly addresses the query.
|
|
|
56 |
|
57 |
def summarize_pdf(pdf_file_path, num_clusters=10):
|
58 |
embeddings_model = OpenAIEmbeddings(model="text-embedding-3-small", api_key=openai_api_key)
|
59 |
+
llm = ChatOpenAI(model="gpt-4o-mini", api_key=openai_api_key, temperature=0.3)
|
60 |
prompt = ChatPromptTemplate.from_template(
|
61 |
"""Could you please provide a concise and comprehensive summary of the given Contexts?
|
62 |
The summary should capture the main points and key details of the text while conveying the author's intended meaning accurately.
|
|
|
89 |
|
90 |
def qa_pdf(pdf_file_path, query, num_clusters=5, similarity_threshold=0.6):
|
91 |
embeddings_model = OpenAIEmbeddings(model="text-embedding-3-small", api_key=openai_api_key)
|
92 |
+
llm = ChatOpenAI(model="gpt-4o-mini", api_key=openai_api_key, temperature=0.3)
|
93 |
prompt = ChatPromptTemplate.from_template(
|
94 |
"""Please provide a detailed and accurate answer to the given question based on the provided contexts.
|
95 |
Ensure that the answer is comprehensive and directly addresses the query.
|