jayash391 commited on
Commit
bff576b
·
verified ·
1 Parent(s): 5aad793

Update sherlock2.py

Browse files
Files changed (1) hide show
  1. sherlock2.py +10 -22
sherlock2.py CHANGED
@@ -355,38 +355,26 @@ def investigate():
355
  with st.expander("Sherlock's Analysis and Suggestions:"):
356
  st.write(response.text)
357
 
358
- # Initialize wikipedia_info with an empty list
359
- wikipedia_info = [] # Add this line here
360
-
361
- search_options = st.multiselect("Search for additional clues:", ["Wikipedia", "Internet"], default=["Wikipedia"])
362
  if st.button("Search"):
363
  with st.spinner("Searching for clues..."):
364
- web_search_results = []
365
- if "Wikipedia" in search_options:
366
- wikipedia_info = search_and_scrape_wikipedia(keywords)
367
- st.subheader("Wikipedia Findings:")
368
- for info in wikipedia_info:
369
- st.write(f"**Topic:** {info['topic']}")
370
- st.write(f"**Summary:** {info['summary']}")
371
- st.write(f"**URL:** {info['url']}")
372
- if "Internet" in search_options:
373
- web_search_results = search_internet("\n\n".join(case_text))
374
- st.subheader("Internet Search Results:")
375
- for result in web_search_results:
376
- st.write(f"**Title:** {result['title']}")
377
- st.write(f"**Snippet:** {result['snippet']}")
378
- st.write(f"**URL:** {result['url']}")
379
 
380
  # Generate report button
381
  if st.button("Generate Case Report"):
382
  with st.spinner("Generating report..."):
383
  report_prompt = """
384
  You are Sherlock Holmes, the renowned detective. Based on the case information, your analysis, findings from
385
- Wikipedia and the web, and the extracted keywords, generate a comprehensive case report in your signature style,
386
  including deductions, potential suspects, and conclusions.
387
- """
388
  final_report = model.generate_content([sherlock_persona, sherlock_guidelines, report_prompt,
389
- case_embeddings_str, str(wikipedia_info), str(web_search_results)])
390
  st.header("Case Report")
391
  st.write(final_report.text)
392
 
 
355
  with st.expander("Sherlock's Analysis and Suggestions:"):
356
  st.write(response.text)
357
 
358
+ search_options = st.multiselect("Search for additional clues:", ["Internet"], default=["Internet"]) # Only "Internet" option
 
 
 
359
  if st.button("Search"):
360
  with st.spinner("Searching for clues..."):
361
+ web_search_results = search_internet("\n\n".join(case_text))
362
+ st.subheader("Internet Search Results:")
363
+ for result in web_search_results:
364
+ st.write(f"**Title:** {result['title']}")
365
+ st.write(f"**Snippet:** {result['snippet']}")
366
+ st.write(f"**URL:** {result['url']}")
 
 
 
 
 
 
 
 
 
367
 
368
  # Generate report button
369
  if st.button("Generate Case Report"):
370
  with st.spinner("Generating report..."):
371
  report_prompt = """
372
  You are Sherlock Holmes, the renowned detective. Based on the case information, your analysis, findings from
373
+ the web, and the extracted keywords, generate a comprehensive case report in your signature style,
374
  including deductions, potential suspects, and conclusions.
375
+ """
376
  final_report = model.generate_content([sherlock_persona, sherlock_guidelines, report_prompt,
377
+ case_embeddings_str, str(web_search_results)]) # Removed wikipedia_info
378
  st.header("Case Report")
379
  st.write(final_report.text)
380