Skip to content

Commit

Permalink
Merge pull request #35 from ibm-ecosystem-engineering/vulnerabilities-ht
Browse files Browse the repository at this point in the history
Vulnerabilities
  • Loading branch information
AnandDas227 authored Oct 9, 2024
2 parents 25c042c + 48004a9 commit 1e8fc2c
Show file tree
Hide file tree
Showing 7 changed files with 1,129 additions and 849 deletions.
52 changes: 14 additions & 38 deletions JudgeIt-App/app/pages/batch/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import {
LLM_JUDGE_DOWNLOAD_EVALUATION_URL,
LLM_JUDGE_API_KEY_SECRET,
} from "@/services/Config";
import { judge_api_batch_call } from "@/services/JudgeBackendAPIBatch";
import {
judge_api_batch_call,
batch_process_status,
} from "@/services/JudgeBackendAPIBatch";
import LinearProgressWithLabel from "@/components/globals/LinearProgressWithLabel";

import * as XLSX from "xlsx";
import BarChart from "@/components/globals/BarChart";
import { create } from "@mui/material/styles/createTransitions";
import BatchInstructions from "@/components/globals/BatchInstructions";
Expand All @@ -51,46 +53,20 @@ const FileUploadForm = () => {
const create_bar_chart = async (chart_task_id) => {
try {
setErrorStatus(null);
const response = await fetch(
LLM_JUDGE_DOWNLOAD_EVALUATION_URL + chart_task_id,
{
method: "GET",
headers: {
Accept: "application/json",
LLM_JUDGE_API_KEY: LLM_JUDGE_API_KEY_SECRET,
},
}
);

if (!response.ok) {
setErrorStatus("Network response was not ok");
throw new Error("Network response was not ok");
}

const blob = await response.blob();
const status_data = await batch_process_status(chart_task_id);
const jsonData =JSON.parse(status_data.result);

// Parse the Excel file
const reader = new FileReader();
reader.onload = (e) => {
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: "array" });
const sheetName = workbook.SheetNames[0];
const worksheet = workbook.Sheets[sheetName];
const jsonData = XLSX.utils.sheet_to_json(worksheet);
// Extract and process the 'Grade' column
const grades =Object.values(jsonData.Grade).filter((grade) => grade !== undefined);

// Extract and process the 'Grade' column
const grades = jsonData
.map((row) => row.Grade)
.filter((grade) => grade !== undefined);
const gradeDistribution = grades.reduce((acc, grade) => {
acc[grade] = (acc[grade] || 0) + 1;
return acc;
}, {});
const gradeDistribution = grades.reduce((acc, grade) => {
acc[grade] = (acc[grade] || 0) + 1;
return acc;
}, {});

setGradeData(gradeDistribution);
};
reader.readAsArrayBuffer(blob);
setGradeData(gradeDistribution);
} catch (error) {
console.error(error)
setErrorStatus("Failed to set grade values");
}
};
Expand Down
4 changes: 2 additions & 2 deletions JudgeIt-App/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {}

export default nextConfig;
module.exports = nextConfig
Loading

0 comments on commit 1e8fc2c

Please sign in to comment.