swayam-the-coder commited on
Commit
9f11287
·
verified ·
1 Parent(s): c305b4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -28
app.py CHANGED
@@ -117,14 +117,6 @@ def analyze_image(image, prompt, api_key):
117
  response = model.generate_content([prompt, image])
118
  return response.text
119
 
120
- # Function to search for research papers
121
- def search_research_papers(query):
122
- search_url = f"https://scholar.google.com/scholar?q={query}"
123
- response = requests.get(search_url)
124
- soup = BeautifulSoup(response.content, 'html.parser')
125
- papers = [{'title': item.select_one('.gs_rt').text, 'link': item.select_one('.gs_rt a')['href']} for item in soup.select('[data-lid]')]
126
- return papers
127
-
128
  # Function to fetch and parse RSS feed
129
  def fetch_rss_feed(feed_url):
130
  feed = feedparser.parse(feed_url)
@@ -333,9 +325,8 @@ def medical_imaging_diagnostics():
333
  st.header("API Key")
334
  api_key = st.text_input("Enter your Google API key:", type="password")
335
 
336
- st.header("Analysis Options")
337
  default_prompt = "Analyze this medical image. Describe what you see, identify any abnormalities, and suggest potential diagnoses."
338
- prompt = st.text_area("Enter your prompt:", value=default_prompt, height=100)
339
 
340
  analyze_button = st.button("Analyze Image")
341
  regenerate_button = st.button("Regenerate Analysis")
@@ -372,13 +363,7 @@ def medical_imaging_diagnostics():
372
  # Generate PDF report
373
  pdf_buffer = create_pdf_report("Yashvi M. Patel", 21, "Female", diagnosis, detailed_diagnosis, "", img_buffer, report_format)
374
  st.download_button(label="Download Report", data=pdf_buffer, file_name="medical_report.pdf", mime="application/pdf")
375
-
376
- # Search for research papers
377
- st.header("Related Research Papers")
378
- papers = search_research_papers(diagnosis)
379
- for paper in papers:
380
- st.markdown(f"[{paper['title']}]({paper['link']})")
381
-
382
  except Exception as e:
383
  st.error(f"An error occurred: {str(e)}")
384
  else:
@@ -396,9 +381,8 @@ def medical_transcription():
396
  st.header("API Key")
397
  api_key = st.text_input("Enter your Google API key:", type="password")
398
 
399
- st.header("Analysis Options")
400
  default_prompt = "Analyze this medical prescription and transcribe it in tabular format."
401
- prompt = st.text_area("Enter your prompt:", value=default_prompt, height=100)
402
 
403
  analyze_button = st.button("Get Transcription")
404
 
@@ -473,7 +457,6 @@ def medical_pathology_diagnostics():
473
  st.header("API Key")
474
  api_key = st.text_input("Enter your Google API key:", type="password")
475
 
476
- st.header("Analysis Options")
477
  default_prompt = """You are a highly skilled medical professional specializing in pathology. Please analyze the uploaded medical pathology report and extract the following information accurately and concisely. Present the information in a structured format with clear labels:
478
 
479
  1. **Patient Information:**
@@ -519,7 +502,7 @@ Ensure that the extracted information is accurate and formatted correctly.
519
 
520
  """
521
 
522
- prompt = st.text_area("Enter your prompt:", value=default_prompt, height=100)
523
 
524
  analyze_button = st.button("Analyze Report")
525
 
@@ -570,9 +553,8 @@ def medical_coding():
570
  st.header("API Key")
571
  api_key = st.text_input("Enter your Google API key:", type="password")
572
 
573
- st.header("Analysis Options")
574
  default_prompt = "Analyze the image and suggest the ICD medical codes with description. Make it simple and concise."
575
- prompt = st.text_area("Enter your prompt:", value=default_prompt, height=100)
576
 
577
  analyze_button = st.button("Get ICD Codes")
578
 
@@ -613,7 +595,6 @@ def insurance_risk_analysis():
613
  st.header("API Key")
614
  api_key = st.text_input("Enter your Google API key:", type="password")
615
 
616
- st.header("Analysis Options")
617
  default_prompt = """You are a highly skilled insurance analyst. Please analyze the uploaded image containing user data and calculate the insurance risk percentage. Provide a detailed justification for the calculated risk percentage based on the data.
618
 
619
  **Format for Output:**
@@ -623,7 +604,7 @@ def insurance_risk_analysis():
623
 
624
  Ensure that the calculated risk and justification are accurate and well-explained."""
625
 
626
- prompt = st.text_area("Enter your prompt:", value=default_prompt, height=100)
627
 
628
  analyze_button = st.button("Analyze Risk")
629
 
@@ -663,8 +644,7 @@ def treatment_diet_plan_generator():
663
 
664
  st.header("API Key")
665
  api_key = st.text_input("Enter your Google API key:", type="password")
666
-
667
- st.header("Analysis Options")
668
  default_prompt = """You are a highly skilled medical professional. Please analyze the uploaded image containing patient data and generate a treatment plan and a diet plan based on the information provided.
669
 
670
  **Format for Output:**
@@ -677,7 +657,7 @@ def treatment_diet_plan_generator():
677
 
678
  Ensure that the plans are accurate and well-explained."""
679
 
680
- prompt = st.text_area("Enter your prompt:", value=default_prompt, height=100)
681
 
682
  generate_plan_button = st.button("Generate Plan")
683
 
 
117
  response = model.generate_content([prompt, image])
118
  return response.text
119
 
 
 
 
 
 
 
 
 
120
  # Function to fetch and parse RSS feed
121
  def fetch_rss_feed(feed_url):
122
  feed = feedparser.parse(feed_url)
 
325
  st.header("API Key")
326
  api_key = st.text_input("Enter your Google API key:", type="password")
327
 
 
328
  default_prompt = "Analyze this medical image. Describe what you see, identify any abnormalities, and suggest potential diagnoses."
329
+ prompt = default_prompt
330
 
331
  analyze_button = st.button("Analyze Image")
332
  regenerate_button = st.button("Regenerate Analysis")
 
363
  # Generate PDF report
364
  pdf_buffer = create_pdf_report("Yashvi M. Patel", 21, "Female", diagnosis, detailed_diagnosis, "", img_buffer, report_format)
365
  st.download_button(label="Download Report", data=pdf_buffer, file_name="medical_report.pdf", mime="application/pdf")
366
+
 
 
 
 
 
 
367
  except Exception as e:
368
  st.error(f"An error occurred: {str(e)}")
369
  else:
 
381
  st.header("API Key")
382
  api_key = st.text_input("Enter your Google API key:", type="password")
383
 
 
384
  default_prompt = "Analyze this medical prescription and transcribe it in tabular format."
385
+ prompt = default_prompt
386
 
387
  analyze_button = st.button("Get Transcription")
388
 
 
457
  st.header("API Key")
458
  api_key = st.text_input("Enter your Google API key:", type="password")
459
 
 
460
  default_prompt = """You are a highly skilled medical professional specializing in pathology. Please analyze the uploaded medical pathology report and extract the following information accurately and concisely. Present the information in a structured format with clear labels:
461
 
462
  1. **Patient Information:**
 
502
 
503
  """
504
 
505
+ prompt = default_prompt
506
 
507
  analyze_button = st.button("Analyze Report")
508
 
 
553
  st.header("API Key")
554
  api_key = st.text_input("Enter your Google API key:", type="password")
555
 
 
556
  default_prompt = "Analyze the image and suggest the ICD medical codes with description. Make it simple and concise."
557
+ prompt = default_prompt
558
 
559
  analyze_button = st.button("Get ICD Codes")
560
 
 
595
  st.header("API Key")
596
  api_key = st.text_input("Enter your Google API key:", type="password")
597
 
 
598
  default_prompt = """You are a highly skilled insurance analyst. Please analyze the uploaded image containing user data and calculate the insurance risk percentage. Provide a detailed justification for the calculated risk percentage based on the data.
599
 
600
  **Format for Output:**
 
604
 
605
  Ensure that the calculated risk and justification are accurate and well-explained."""
606
 
607
+ prompt = default_prompt
608
 
609
  analyze_button = st.button("Analyze Risk")
610
 
 
644
 
645
  st.header("API Key")
646
  api_key = st.text_input("Enter your Google API key:", type="password")
647
+
 
648
  default_prompt = """You are a highly skilled medical professional. Please analyze the uploaded image containing patient data and generate a treatment plan and a diet plan based on the information provided.
649
 
650
  **Format for Output:**
 
657
 
658
  Ensure that the plans are accurate and well-explained."""
659
 
660
+ prompt = default_prompt
661
 
662
  generate_plan_button = st.button("Generate Plan")
663