Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -151,8 +151,34 @@ if uploaded_query_image:
|
|
151 |
encoded_image_url = local_image_to_data_url(query_image_path)
|
152 |
|
153 |
# Setup query engine
|
154 |
-
QA_PROMPT_TMPL = """
|
155 |
-
You are a friendly medical chatbot designed to assist users by providing accurate and detailed responses to medical questions based on information from medical books.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
### Context:
|
158 |
---------------------
|
@@ -169,6 +195,7 @@ You are a friendly medical chatbot designed to assist users by providing accurat
|
|
169 |
|
170 |
### Answer:
|
171 |
"""
|
|
|
172 |
QA_PROMPT = PromptTemplate(QA_PROMPT_TMPL)
|
173 |
gpt_4o_mm = OpenAIMultiModal(model="gpt-4o-mini-2024-07-18")
|
174 |
|
|
|
151 |
encoded_image_url = local_image_to_data_url(query_image_path)
|
152 |
|
153 |
# Setup query engine
|
154 |
+
# QA_PROMPT_TMPL = """
|
155 |
+
# You are a friendly medical chatbot designed to assist users by providing accurate and detailed responses to medical questions based on information from medical books.
|
156 |
+
|
157 |
+
# ### Context:
|
158 |
+
# ---------------------
|
159 |
+
# {context_str}
|
160 |
+
# ---------------------
|
161 |
+
|
162 |
+
# ### Query Text:
|
163 |
+
# {query_str}
|
164 |
+
|
165 |
+
# ### Query Image:
|
166 |
+
# ---------------------
|
167 |
+
# {encoded_image_url}
|
168 |
+
# ---------------------
|
169 |
+
|
170 |
+
# ### Answer:
|
171 |
+
# """
|
172 |
+
|
173 |
+
QA_PROMPT_TMPL="""You are a friendly medical chatbot designed to assist users by providing accurate and detailed responses to medical questions based on information from medical books.
|
174 |
+
|
175 |
+
In this task, you will receive parsed text from books in two formats: **Markdown mode** and **Raw text mode**. Markdown mode converts relevant diagrams into tables for clarity, while raw text mode preserves the original layout of the content.
|
176 |
+
|
177 |
+
### Key Guidelines:
|
178 |
+
- **Prioritize Image Information**: Always analyze the image provided first for relevant details. Use the text or markdown information only if the image does not contain the necessary information.
|
179 |
+
- **No Image Links**: Your responses should contain only text explanations. Do not include links to images or other resources.
|
180 |
+
- **Contextual Answers**: Your answers should strictly rely on the provided context information.
|
181 |
+
|
182 |
|
183 |
### Context:
|
184 |
---------------------
|
|
|
195 |
|
196 |
### Answer:
|
197 |
"""
|
198 |
+
|
199 |
QA_PROMPT = PromptTemplate(QA_PROMPT_TMPL)
|
200 |
gpt_4o_mm = OpenAIMultiModal(model="gpt-4o-mini-2024-07-18")
|
201 |
|