zliang commited on
Commit
8eab150
·
verified ·
1 Parent(s): 3d8d27c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -150,7 +150,7 @@ Context Excerpts:
150
  @handle_errors
151
  def qa_pdf(_pdf_file_path, query, num_clusters=5):
152
  embeddings_model = OpenAIEmbeddings(model="text-embedding-3-small", api_key=openai_api_key)
153
- llm = ChatOpenAI(model="gpt-4", api_key=openai_api_key, temperature=0.3)
154
 
155
  prompt = ChatPromptTemplate.from_template(
156
  """Answer this question: {question}
@@ -190,7 +190,7 @@ def process_pdf(_pdf_file_path):
190
  scale_factor = 300 / 50 # High-res to low-res ratio
191
 
192
  for page in doc:
193
- low_res = page.get_pixmap(dpi=50)
194
  low_res_img = np.frombuffer(low_res.samples, dtype=np.uint8).reshape(low_res.height, low_res.width, 3)
195
 
196
  results = model.predict(low_res_img)
 
150
  @handle_errors
151
  def qa_pdf(_pdf_file_path, query, num_clusters=5):
152
  embeddings_model = OpenAIEmbeddings(model="text-embedding-3-small", api_key=openai_api_key)
153
+ llm = ChatOpenAI(model="gpt-3.5-turbo", api_key=openai_api_key, temperature=0.3)
154
 
155
  prompt = ChatPromptTemplate.from_template(
156
  """Answer this question: {question}
 
190
  scale_factor = 300 / 50 # High-res to low-res ratio
191
 
192
  for page in doc:
193
+ low_res = page.get_pixmap(dpi=300)
194
  low_res_img = np.frombuffer(low_res.samples, dtype=np.uint8).reshape(low_res.height, low_res.width, 3)
195
 
196
  results = model.predict(low_res_img)