speech-to-speech
This commit is contained in:
+183
@@ -0,0 +1,183 @@
|
||||
# import json
|
||||
|
||||
# print("=" * 50)
|
||||
# print("AI MEDICAL EXAMINER ASSISTANT")
|
||||
# print("=" * 50)
|
||||
|
||||
# # Simulated transcript
|
||||
# transcript = input("\nEnter patient statement:\n> ")
|
||||
|
||||
# text = transcript.lower()
|
||||
|
||||
# detected_conditions = []
|
||||
# questions = []
|
||||
|
||||
# # Disease Question Bank
|
||||
# question_bank = {
|
||||
# "diabetes": [
|
||||
# "When were you diagnosed?",
|
||||
# "What is your current HbA1c?",
|
||||
# "Are you taking insulin?",
|
||||
# "Any kidney disease?",
|
||||
# "Any eye complications?"
|
||||
# ],
|
||||
# "hypertension": [
|
||||
# "Since when do you have hypertension?",
|
||||
# "Current BP readings?",
|
||||
# "Are you taking medication regularly?",
|
||||
# "Any heart disease?",
|
||||
# "Any stroke history?"
|
||||
# ],
|
||||
# "smoke": [
|
||||
# "How many cigarettes per day?",
|
||||
# "For how many years?",
|
||||
# "Current smoker or ex-smoker?",
|
||||
# "Any chronic cough?",
|
||||
# "Any COPD symptoms?"
|
||||
# ]
|
||||
# }
|
||||
|
||||
# # Detect conditions
|
||||
# if "diabetes" in text:
|
||||
# detected_conditions.append("Diabetes")
|
||||
# questions.extend(question_bank["diabetes"])
|
||||
|
||||
# if "hypertension" in text or "bp" in text:
|
||||
# detected_conditions.append("Hypertension")
|
||||
# questions.extend(question_bank["hypertension"])
|
||||
|
||||
# if "smoke" in text or "smoking" in text:
|
||||
# detected_conditions.append("Smoking")
|
||||
# questions.extend(question_bank["smoke"])
|
||||
|
||||
# print("\nDetected Conditions:")
|
||||
# for condition in detected_conditions:
|
||||
# print(f"✓ {condition}")
|
||||
|
||||
# if not detected_conditions:
|
||||
# print("No predefined condition detected.")
|
||||
# exit()
|
||||
|
||||
# print("\nSuggested Follow-Up Questions:")
|
||||
# for i, q in enumerate(questions, start=1):
|
||||
# print(f"{i}. {q}")
|
||||
|
||||
# # Collect answers
|
||||
# answers = {}
|
||||
|
||||
# print("\nEnter Patient Answers:")
|
||||
# for q in questions:
|
||||
# answers[q] = input(f"{q} : ")
|
||||
|
||||
# # Generate summary
|
||||
# print("\n" + "=" * 50)
|
||||
# print("FINAL MEDICAL SUMMARY")
|
||||
# print("=" * 50)
|
||||
|
||||
# print("\nPatient Statement:")
|
||||
# print(transcript)
|
||||
|
||||
# print("\nDetected Conditions:")
|
||||
# for condition in detected_conditions:
|
||||
# print(f"- {condition}")
|
||||
|
||||
# print("\nResponses:")
|
||||
# for question, answer in answers.items():
|
||||
# print(f"- {question}: {answer}")
|
||||
|
||||
# print("\nMedical Completeness Score: 90%")
|
||||
# print("Contradiction Score: Low")
|
||||
# print("Additional Investigation: Recommended")
|
||||
|
||||
# print("\nAreas Requiring Review:")
|
||||
# for condition in detected_conditions:
|
||||
# print(f"- {condition}")
|
||||
|
||||
# print("\nReport Generated Successfully.")
|
||||
# print("=" * 50)
|
||||
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from elevenlabs.client import ElevenLabs
|
||||
|
||||
load_dotenv()
|
||||
|
||||
client = ElevenLabs(
|
||||
api_key=os.getenv("ELEVENLABS_API_KEY")
|
||||
)
|
||||
|
||||
print("=" * 60)
|
||||
print("AI MEDICAL EXAMINER ASSISTANT")
|
||||
print("=" * 60)
|
||||
|
||||
medical_questions = {
|
||||
"diabetes": [
|
||||
"When were you diagnosed?",
|
||||
"What medications are you taking?",
|
||||
"Do you use insulin?",
|
||||
"Any kidney disease?",
|
||||
"Any eye complications?"
|
||||
],
|
||||
"hypertension": [
|
||||
"Since when do you have hypertension?",
|
||||
"What is your current BP reading?",
|
||||
"Are you taking medications regularly?",
|
||||
"Any heart disease?",
|
||||
"Any stroke history?"
|
||||
],
|
||||
"smoking": [
|
||||
"How many cigarettes per day?",
|
||||
"For how many years have you smoked?",
|
||||
"Current smoker or ex-smoker?",
|
||||
"Any chronic cough?",
|
||||
"Any COPD symptoms?"
|
||||
]
|
||||
}
|
||||
|
||||
answers = {}
|
||||
|
||||
print("\nAI Doctor: Do you have diabetes? (yes/no)")
|
||||
diabetes = input("Patient: ").strip().lower()
|
||||
|
||||
if diabetes == "yes":
|
||||
answers["Condition"] = "Diabetes"
|
||||
|
||||
for question in medical_questions["diabetes"]:
|
||||
print(f"\nAI Doctor: {question}")
|
||||
response = input("Patient: ")
|
||||
answers[question] = response
|
||||
|
||||
print("\nAI Doctor: Do you have hypertension? (yes/no)")
|
||||
hypertension = input("Patient: ").strip().lower()
|
||||
|
||||
if hypertension == "yes":
|
||||
answers["Hypertension"] = "Yes"
|
||||
|
||||
for question in medical_questions["hypertension"]:
|
||||
print(f"\nAI Doctor: {question}")
|
||||
response = input("Patient: ")
|
||||
answers[question] = response
|
||||
|
||||
print("\nAI Doctor: Do you smoke? (yes/no)")
|
||||
smoking = input("Patient: ").strip().lower()
|
||||
|
||||
if smoking == "yes":
|
||||
answers["Smoking"] = "Yes"
|
||||
|
||||
for question in medical_questions["smoking"]:
|
||||
print(f"\nAI Doctor: {question}")
|
||||
response = input("Patient: ")
|
||||
answers[question] = response
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("FINAL MEDICAL REPORT")
|
||||
print("=" * 60)
|
||||
|
||||
for key, value in answers.items():
|
||||
print(f"{key}: {value}")
|
||||
|
||||
print("\nMedical Completeness Score: 95%")
|
||||
print("Contradiction Score: Low")
|
||||
print("Additional Investigation Recommended: Yes")
|
||||
|
||||
print("=" * 60)
|
||||
Reference in New Issue
Block a user