awacke1 commited on
Commit
dd39660
·
verified ·
1 Parent(s): 1bd9563

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -638,13 +638,13 @@ with tab_md_gallery:
638
  st.markdown(get_download_link(output_filename, "text/markdown", f"Download {output_filename}"), unsafe_allow_html=True)
639
  except Exception as e:
640
  st.error(f"Error processing {md_file}: {str(e)}")
641
- st.subheader("Batch Processing")
642
  st.write("Select MD files to combine and process:")
643
  selected_md = {}
644
  for md_file in md_files:
645
  selected_md[md_file] = st.checkbox(md_file, key=f"checkbox_md_{md_file}")
646
- batch_prompt = st.text_input("Enter batch processing prompt", "Summarize this into markdown outline with emojis and number the topics 1..12", key="batch_prompt")
647
- if st.button("Process Selected MD Files", key="process_batch_md"):
648
  combined_content = ""
649
  for md_file, selected in selected_md.items():
650
  if selected:
@@ -654,13 +654,13 @@ with tab_md_gallery:
654
  except Exception as e:
655
  st.error(f"Error reading {md_file}: {str(e)}")
656
  if combined_content:
657
- result_text = process_text_with_prompt(combined_content, batch_prompt, model=selected_gpt_model)
658
  st.markdown(result_text)
659
- output_filename = generate_filename("batch_processed_md", "md")
660
  with open(output_filename, "w", encoding="utf-8") as f:
661
  f.write(result_text)
662
- st.success(f"Batch processing complete. MD file saved as {output_filename}")
663
- st.markdown(get_download_link(output_filename, "text/markdown", "Download Batch Processed MD"), unsafe_allow_html=True)
664
  else:
665
  st.warning("No MD files selected.")
666
  else:
 
638
  st.markdown(get_download_link(output_filename, "text/markdown", f"Download {output_filename}"), unsafe_allow_html=True)
639
  except Exception as e:
640
  st.error(f"Error processing {md_file}: {str(e)}")
641
+ st.subheader("Knowledge Processing")
642
  st.write("Select MD files to combine and process:")
643
  selected_md = {}
644
  for md_file in md_files:
645
  selected_md[md_file] = st.checkbox(md_file, key=f"checkbox_md_{md_file}")
646
+ Knowledge_prompt = st.text_input("1. Change into a numbered markdown outline with emojis. 2. Number the topics and make sure to include all data.", key="Knowledge_prompt")
647
+ if st.button("Process Selected MD Files", key="process_Knowledge_md"):
648
  combined_content = ""
649
  for md_file, selected in selected_md.items():
650
  if selected:
 
654
  except Exception as e:
655
  st.error(f"Error reading {md_file}: {str(e)}")
656
  if combined_content:
657
+ result_text = process_text_with_prompt(combined_content, Knowledge_prompt, model=selected_gpt_model)
658
  st.markdown(result_text)
659
+ output_filename = generate_filename("Knowledge_processed_md", "md")
660
  with open(output_filename, "w", encoding="utf-8") as f:
661
  f.write(result_text)
662
+ st.success(f"Knowledge processing complete. MD file saved as {output_filename}")
663
+ st.markdown(get_download_link(output_filename, "text/markdown", "Download Knowledge Processed MD"), unsafe_allow_html=True)
664
  else:
665
  st.warning("No MD files selected.")
666
  else: