Spaces:
Running
Running
UI changes
Browse files
app.py
CHANGED
@@ -19,7 +19,14 @@ os.environ["SERPER_API_KEY"] = os.getenv("SERPER_API_KEY")
|
|
19 |
def generate_docx(result):
|
20 |
doc = Document()
|
21 |
doc.add_heading('Healthcare Diagnosis and Treatment Recommendations', 0)
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
bio = BytesIO()
|
24 |
doc.save(bio)
|
25 |
bio.seek(0)
|
@@ -216,7 +223,12 @@ if st.button("Generate Analysis"):
|
|
216 |
|
217 |
# Display Results
|
218 |
st.markdown("### π Analysis Results")
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
# Generate and offer download
|
222 |
docx_file = generate_docx(result)
|
|
|
19 |
def generate_docx(result):
|
20 |
doc = Document()
|
21 |
doc.add_heading('Healthcare Diagnosis and Treatment Recommendations', 0)
|
22 |
+
|
23 |
+
# Convert result to string if it's a tuple
|
24 |
+
if isinstance(result, tuple):
|
25 |
+
result_str = '\n\n'.join(str(item) for item in result)
|
26 |
+
else:
|
27 |
+
result_str = str(result)
|
28 |
+
|
29 |
+
doc.add_paragraph(result_str)
|
30 |
bio = BytesIO()
|
31 |
doc.save(bio)
|
32 |
bio.seek(0)
|
|
|
223 |
|
224 |
# Display Results
|
225 |
st.markdown("### π Analysis Results")
|
226 |
+
if isinstance(result, tuple):
|
227 |
+
for item in result:
|
228 |
+
st.markdown(str(item))
|
229 |
+
st.markdown("---") # Add a separator between items
|
230 |
+
else:
|
231 |
+
st.markdown(str(result))
|
232 |
|
233 |
# Generate and offer download
|
234 |
docx_file = generate_docx(result)
|