Shreyas094 commited on
Commit
1634f94
·
verified ·
1 Parent(s): 40b3098

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -25
app.py CHANGED
@@ -532,32 +532,7 @@ Highlight any conflicting information or gaps in the available data."""
532
  overall_summary += chunk
533
  accumulated_response += f"Overall Summary:\n\n{overall_summary}\n\n"
534
  yield accumulated_response, ""
535
-
536
- # Generate an overall summary after processing all sources
537
- overall_prompt = f"""Based on the summaries you've generated for each source: '{accumulated_response}', provide a concise overall summary that addresses the user's query: '{query}'
538
- Highlight any conflicting information or gaps in the available data."""
539
 
540
- if model == "@cf/meta/llama-3.1-8b-instruct":
541
- # Use Cloudflare API for overall summary
542
- overall_response = ""
543
- for response in get_response_from_cloudflare(prompt="", context="", query=overall_prompt, num_calls=1, temperature=temperature, search_type="web"):
544
- overall_response += response
545
- accumulated_response += f"Overall Summary:\n\n{overall_response}\n\n"
546
- yield accumulated_response, ""
547
- else:
548
- # Use Hugging Face API for overall summary
549
- overall_summary = ""
550
- for message in client.chat_completion(
551
- messages=[{"role": "user", "content": overall_prompt}],
552
- max_tokens=2000,
553
- temperature=temperature,
554
- stream=True,
555
- ):
556
- if message.choices and message.choices[0].delta and message.choices[0].delta.content:
557
- chunk = message.choices[0].delta.content
558
- overall_summary += chunk
559
- accumulated_response += f"Overall Summary:\n\n{overall_summary}\n\n"
560
- yield accumulated_response, ""
561
 
562
  def get_response_from_pdf(query, model, selected_docs, num_calls=3, temperature=0.2):
563
  logging.info(f"Entering get_response_from_pdf with query: {query}, model: {model}, selected_docs: {selected_docs}")
 
532
  overall_summary += chunk
533
  accumulated_response += f"Overall Summary:\n\n{overall_summary}\n\n"
534
  yield accumulated_response, ""
 
 
 
 
535
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
 
537
  def get_response_from_pdf(query, model, selected_docs, num_calls=3, temperature=0.2):
538
  logging.info(f"Entering get_response_from_pdf with query: {query}, model: {model}, selected_docs: {selected_docs}")