Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| from src.main import process_image # Assume process_image is a function in main.py | |
| from src.assess_text import assess_essay_with_gpt | |
| from src.transcribe_image import transcribe_image | |
| from PIL import Image | |
| st.title("AutoAssess: Student Essay Transcription and Assessment") | |
| # Upload folder of images | |
| uploaded_files = st.file_uploader("Upload a folder of student essays (images)", type=['jpg', 'jpeg', 'png'], accept_multiple_files=True) | |
| # Text inputs for question and criteria | |
| essay_question = st.text_input("Enter the essay question:") | |
| grading_criteria = st.text_area("Enter grading criteria or relevant marking information:") | |
| # Upload Excel file with student IDs and page count | |
| student_info_file = st.file_uploader("Upload Excel file with student IDs and page count", type=["xlsx"]) | |
| if st.button("Process Essays"): | |
| if not uploaded_files or not essay_question or not grading_criteria or not student_info_file: | |
| st.warning("Please upload all required files and enter necessary information.") | |
| else: | |
| # Process student info file | |
| student_df = pd.read_excel(student_info_file) | |
| st.write("Student Information:") | |
| st.write(student_df) | |
| results = [] | |
| for uploaded_file in uploaded_files: | |
| image = Image.open(uploaded_file) | |
| # Use your backend function to process each image | |
| transcription = process_image(image, essay_question, grading_criteria) | |
| results.append({"filename": uploaded_file.name, "transcription": transcription}) | |
| for result in results: | |
| st.write(f"**File:** {result['filename']}") | |
| st.write(result['transcription']) | |
| # Optional: Save results to the output folder | |
| output_file = "output/results.csv" | |
| pd.DataFrame(results).to_csv(output_file) | |
| st.success(f"All essays processed. Results saved to {output_file}") |