vijayvizag's picture
Initial commit for Hugging Face Space
2a1cdbf
raw
history blame
1.17 kB
import streamlit as st
from utils.summarizer import summarize_code
from utils.doc_generator import generate_document, generate_pptx
import os
st.title("πŸ“„ Code to Project Document Generator")
st.write("Upload your code files and a headings.txt file.")
uploaded_files = st.file_uploader("Upload code files (Python/React)", accept_multiple_files=True)
headings_file = st.file_uploader("Upload headings.txt", type="txt")
if st.button("Generate Document") and uploaded_files and headings_file:
with open("headings.txt", "wb") as f:
f.write(headings_file.read())
code_dir = "uploaded_code"
os.makedirs(code_dir, exist_ok=True)
for file in uploaded_files:
with open(os.path.join(code_dir, file.name), "wb") as f:
f.write(file.read())
sections = summarize_code(code_dir, "headings.txt")
generate_document(sections)
generate_pptx(sections)
st.success("Documents generated!")
st.download_button("Download DOCX", data=open("project_report.docx", "rb"), file_name="project_report.docx")
st.download_button("Download PPTX", data=open("project_presentation.pptx", "rb"), file_name="project_presentation.pptx")