naughtondale commited on
Commit
dbd6a2e
·
1 Parent(s): a53b5c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -26,7 +26,7 @@ def pdf_to_text(pdf_file):
26
  def call_openai_model(text_content, question):
27
  try:
28
  conversation = [
29
- {"role": "system", "content": "You are a helpful assistant."},
30
  {"role": "user", "content": text_content},
31
  {"role": "user", "content": question}
32
  ]
@@ -80,8 +80,15 @@ iface = gr.Interface(
80
  primary_hue="blue",
81
  secondary_hue="blue",
82
  neutral_hue="blue"),
83
- #title="INSTRUCTIONS:",
84
- description="This is a helpful AI assistant that allows you to upload your lab report in PDF format, the report you get by scanning the QR code (with phone camera or webcam) at the top right of the printout given to you by the hospital. After downloading that PDF report to your PC, mobile phone or tablet, upload it to this chatbot and ask questions about those results and get answers from a kind, friendly, and professional doctor. Be sure to compare these answers with what your real, personal or family Doctor offers. The chatbot will try to find the answer from the lab report and share it with you. You can ask questions about any aspect of your lab results, such as what they mean, how they compare to normal ranges, what causes them, or what actions you should take. Again, the chatbot is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.<br><br><strong>INSTRUCTIONS:</strong><br><br>1. Upload your lab report in PDF format. If results are inaccurate or null, ensure the document uploaded is not password protected, is editable text, and is not just a scanned image of a document.\n\n2. Type your question in the text box below. The question should be relevant to and potentially answerable in the document you uploaded.\n\n3. Click ‘Submit’ to start the answering process. An answer is returned shortly after in the scrollable output box, depending on the complexity of the question.\n\n4. Click ‘Clear’ to remove the submitted document, question, and answer so that you can upload another document and ask another question.")
 
 
 
 
 
 
 
85
 
86
 
87
 
 
26
  def call_openai_model(text_content, question):
27
  try:
28
  conversation = [
29
+ {"role": "system", "content": "You are a Spanish-speaking chatbot that adopts the persona of a doctor who answers questions about users' uploaded lab results.As an AI doctor you are kind,courteous, friendly, and professional. You address the patient by name if it is on the lab report, and use second person pronouns (you/your) when talking to the patient who you assume uploaded the results.You allow the patient to upload their lab report in PDF format and ask questions about the results.You then intelligently respond in natural language to user questions and directions based only on the contents of the report uploaded. You also examine the uploaded document and if it does not seem like a lab report or a medical document, you politely explain to the user that you are only trained to answer questions on lab reports or medical documents. You only respond or communicate to the user in Spanish or Espanol."},
30
  {"role": "user", "content": text_content},
31
  {"role": "user", "content": question}
32
  ]
 
80
  primary_hue="blue",
81
  secondary_hue="blue",
82
  neutral_hue="blue"),
83
+ title="Sistema de IA para Laboratorios de Salud",
84
+ description = '''
85
+ Conoce a "Health Labs", tu analista de salud personal e innovador, diseñado para revolucionar la manera en que interactúas con los resultados de análisis que recibes después de hacerte pruebas en un laboratorio, clínica u hospital que visitaste para verificar una condición de salud específica o tu salud general. Dichos informes suelen tener muchos términos médicos desconocidos y métricas que nuestro doctor, tratando con una larga cola de pacientes, podría no tener tiempo de explicar en detalle. Health Labs te brindará toda la atención que desees por todo el tiempo que quieras, ofreciendo explicaciones de cualquier cosa de la manera más sencilla que desees. Aconsejamos que confirmes esas explicaciones o recomendaciones con tu verdadero médico o clínico antes de hacer una aplicación personal o tomar decisiones. Para comenzar, simplemente sigue las instrucciones a continuación con una copia reciente de tus resultados de laboratorio en mano.
86
+ INSTRUCCIONES:
87
+ Escanea el código QR (con tu móvil/cámara web) que se encuentra en la esquina superior derecha de tus resultados de pruebas impresos y sube el PDF que obtengas del enlace generado a Health Labs.
88
+ Escribe tu pregunta en el cuadro de texto que está debajo del área de carga de documentos. La pregunta debe ser relevante y potencialmente respondida en el documento de laboratorio que subiste.
89
+ Haz clic en 'Enviar' para comenzar el proceso de respuesta. Recibirás una respuesta poco después en el cuadro de salida desplazable, dependiendo de la complejidad de la pregunta. Haz tantas preguntas o solicita tantas sugerencias sobre tu condición de salud como desees.
90
+ Haz clic en 'Borrar' para eliminar el documento enviado, la pregunta y la respuesta, para que puedas subir otro documento y hacer preguntas sobre él.
91
+ ''')
92
 
93
 
94