Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,16 +28,6 @@ def parse_feedback(feedback):
|
|
| 28 |
|
| 29 |
}
|
| 30 |
|
| 31 |
-
# lines = feedback.split('\n')
|
| 32 |
-
# for line in lines:
|
| 33 |
-
# for key in scores.keys():
|
| 34 |
-
# if key in line:
|
| 35 |
-
# score = line.split(':')[-1].strip()
|
| 36 |
-
# scores[key] = score
|
| 37 |
-
|
| 38 |
-
# # Assume that the last numerical value mentioned is the total score
|
| 39 |
-
# total_score = sum([int(score) for score in scores.values() if score])
|
| 40 |
-
# scores['Total Score'] = total_score
|
| 41 |
return scores
|
| 42 |
|
| 43 |
# Function to grade the essay using GPT-4
|
|
@@ -71,15 +61,16 @@ def grade_essay(essay, guided_data, barem):
|
|
| 71 |
return response.choices[0].message.content
|
| 72 |
def read_pdf(pdf_reader):
|
| 73 |
for page in pdf_reader.pages:
|
|
|
|
| 74 |
page_text = page.extract_text()
|
| 75 |
if page_text:
|
| 76 |
all_text += page_text + "\n"
|
| 77 |
return all_text
|
| 78 |
|
| 79 |
-
# Function to export results to CSV
|
| 80 |
-
def export_to_csv(data):
|
| 81 |
-
|
| 82 |
-
|
| 83 |
|
| 84 |
# Main function for the Streamlit app
|
| 85 |
def main():
|
|
|
|
| 28 |
|
| 29 |
}
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
return scores
|
| 32 |
|
| 33 |
# Function to grade the essay using GPT-4
|
|
|
|
| 61 |
return response.choices[0].message.content
|
| 62 |
def read_pdf(pdf_reader):
|
| 63 |
for page in pdf_reader.pages:
|
| 64 |
+
all_text = ""
|
| 65 |
page_text = page.extract_text()
|
| 66 |
if page_text:
|
| 67 |
all_text += page_text + "\n"
|
| 68 |
return all_text
|
| 69 |
|
| 70 |
+
# # Function to export results to CSV
|
| 71 |
+
# def export_to_csv(data):
|
| 72 |
+
# df = pd.DataFrame(data)
|
| 73 |
+
# df.to_csv('essay_grades.csv', index=False)
|
| 74 |
|
| 75 |
# Main function for the Streamlit app
|
| 76 |
def main():
|