gauravgulati619 aryanxxvii commited on
Commit
329e03a
·
verified ·
1 Parent(s): c9467a8

Update app.py (#2)

Browse files

- Update app.py (01bb8350fb1c7f9e763e88f26e0b9d304ee87b96)


Co-authored-by: Aryan Wadhawan <aryanxxvii@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -96,8 +96,10 @@ def get_relevant_context(query):
96
 
97
  # Extract and combine the content from retrieved documents
98
  context = "\n".join([doc.page_content for doc in docs])
 
 
 
99
 
100
- return context
101
  except Exception as e:
102
  print(f"Error in similarity search: {e}")
103
  return "Could not retrieve relevant context."
@@ -105,7 +107,7 @@ def get_relevant_context(query):
105
  # Update system prompt to include retrieved context
106
  def get_enhanced_prompt(query, context):
107
  enhanced_prompt = f"""You have to act as a professional doctor, i know you are not but this is for learning purpose.
108
- Use the following medical context to inform your response: {context}
109
  What's in this image?. Do you find anything wrong with it medically?
110
  If you make a differential, suggest some remedies for them. Donot add any numbers or special characters in
111
  your response. Your response should be in one long paragraph. Also always answer as if you are answering to a real person.
 
96
 
97
  # Extract and combine the content from retrieved documents
98
  context = "\n".join([doc.page_content for doc in docs])
99
+ context = "Use the following medical context to inform your response: " + context
100
+
101
+ return context if not context else ""
102
 
 
103
  except Exception as e:
104
  print(f"Error in similarity search: {e}")
105
  return "Could not retrieve relevant context."
 
107
  # Update system prompt to include retrieved context
108
  def get_enhanced_prompt(query, context):
109
  enhanced_prompt = f"""You have to act as a professional doctor, i know you are not but this is for learning purpose.
110
+ {context}
111
  What's in this image?. Do you find anything wrong with it medically?
112
  If you make a differential, suggest some remedies for them. Donot add any numbers or special characters in
113
  your response. Your response should be in one long paragraph. Also always answer as if you are answering to a real person.