Yashvj123 commited on
Commit
672d77f
·
verified ·
1 Parent(s): dbd7162

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -238,7 +238,7 @@ if uploaded_file:
238
  if len(parts) > 1:
239
  filtered_output = parts[1].strip()
240
  else:
241
- filtered_output = full_output
242
 
243
  st.markdown("#### 💡 AI-based Medicine Analysis")
244
  st.text_area("LLM Output", filtered_output, height=300)
@@ -246,18 +246,18 @@ if uploaded_file:
246
  # Save txt and image
247
  txt_path = "medicine_analysis.txt"
248
  with open(txt_path, "w") as f:
249
- f.write(response)
250
 
251
  img_path = "medicine_analysis.png"
252
- save_text_as_image(response, img_path)
253
 
254
  st.markdown("#### 📥 Download (English)")
255
  col1, col2 = st.columns(2)
256
  with col1:
257
- st.download_button("⬇️ English TXT", data=response.encode(), file_name="medicine_analysis.txt")
258
  with col2:
259
  with open(img_path, "rb") as img_file:
260
- st.download_button("🖼️ English Image", data=img_file, file_name="medicine_analysis.png", mime="image/png")\
261
 
262
  # if response and st.button("🌐 Translate to Hindi"):
263
  # with st.spinner("Translating to Hindi..."):
 
238
  if len(parts) > 1:
239
  filtered_output = parts[1].strip()
240
  else:
241
+ filtered_output = response
242
 
243
  st.markdown("#### 💡 AI-based Medicine Analysis")
244
  st.text_area("LLM Output", filtered_output, height=300)
 
246
  # Save txt and image
247
  txt_path = "medicine_analysis.txt"
248
  with open(txt_path, "w") as f:
249
+ f.write(filtered_output)
250
 
251
  img_path = "medicine_analysis.png"
252
+ save_text_as_image(filtered_output, img_path)
253
 
254
  st.markdown("#### 📥 Download (English)")
255
  col1, col2 = st.columns(2)
256
  with col1:
257
+ st.download_button("⬇️ English TXT", data=filtered_output.encode(), file_name="medicine_analysis.txt")
258
  with col2:
259
  with open(img_path, "rb") as img_file:
260
+ st.download_button("🖼️ English Image", data=img_file, file_name="medicine_analysis.png", mime="image/png")
261
 
262
  # if response and st.button("🌐 Translate to Hindi"):
263
  # with st.spinner("Translating to Hindi..."):