-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(qa_evaluator): Improve QA evaluator
- Loading branch information
Showing
5 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
from typing import Any, Dict, List, Optional, Tuple, Union | ||
|
||
import numpy as np | ||
import pandas as pd | ||
import pkg_resources | ||
import requests | ||
import yaml | ||
|
@@ -152,3 +153,32 @@ def compress_and_remove(filepath: T_path) -> None: | |
) as arc: | ||
arc.write(filepath, arcname=filepath.name) | ||
filepath.unlink() | ||
|
||
|
||
def convert_qa_df_to_bootstrap_html(df: pd.DataFrame) -> str: | ||
boostrap_cdn = ( | ||
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" ' | ||
'integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">' | ||
) | ||
|
||
output = ( | ||
"<!DOCTYPE html>" | ||
+ "\n" | ||
+ "<html>" | ||
+ "\n" | ||
+ "<head>" | ||
+ "\n" | ||
+ boostrap_cdn | ||
+ "\n" | ||
+ '<meta charset="utf-8">' | ||
+ "\n" | ||
+ "</head>" | ||
+ "\n" | ||
+ "<body>" | ||
+ "\n" | ||
+ df.to_html(classes=["table table-bordered table-striped table-hover"]) | ||
+ "\n" | ||
+ "</body>" | ||
) | ||
assert isinstance(output, str) | ||
return output |