-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added better mobile support - Added additional information about the project - Changed the layout
- Loading branch information
1 parent
663ddf1
commit 7f37685
Showing
11 changed files
with
372 additions
and
150 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export default function About() { | ||
return ( | ||
<main | ||
className="grid grid-rows-[20px_1fr_20px] justify-items-center p-8 gap-16 sm:p-0 min-h-screen font-[family-name:var(--font-geist-sans) | ||
mx-auto w-full max-w-screen-xl" | ||
> | ||
<div className="flex flex-col gap-8 row-start-2 items-center sm:items-start"> | ||
<div className="flex-grow grid h-screen place-content-center bg-white px-4"> | ||
<div className="text-center"> | ||
<p className="text-2xl font-bold tracking-tight text-gray-900 sm:text-4xl"> | ||
Uh-oh! Under construction. | ||
</p> | ||
|
||
<p className="mt-4 text-gray-700"> | ||
We are glad for your interest in the application. Unfortunately at | ||
this time the About page is still under construction. Meanwhile if | ||
you are still craving for more information do feel free to check | ||
out our{" "} | ||
<a | ||
href="https://github.com/filipepcampos/case-based-explanations-demo" | ||
className="text-blue-500 hover:text-blue-700" | ||
> | ||
github repository. | ||
</a> | ||
</p> | ||
|
||
<a | ||
href="/" | ||
className="mt-6 inline-block rounded bg-blue-500 px-5 py-3 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring" | ||
> | ||
Go Back Home | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,38 +1,25 @@ | ||
import { env } from "next-runtime-env"; | ||
|
||
import Image from "next/image"; | ||
import InteractiveSection from "../components/InteractiveSection"; | ||
import Footer from "@/components/Footer"; | ||
|
||
export default function Home() { | ||
// Send a heartbeat to the API to wake up the API container | ||
const host = env("NEXT_PUBLIC_API_HOST"); | ||
fetch(`${host}/`, { method: "GET"}); | ||
fetch(`${host}/`, { method: "GET" }); | ||
|
||
return ( | ||
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]"> | ||
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start"> | ||
<h1 className="flex mb-4 text-4xl font-extrabold leading-none text-gray-900 md:text-5xl lg:text-6xl dark:text-white"> | ||
Case-based explanations demo | ||
<main | ||
className="grid grid-rows-[20px_1fr_20px] justify-items-center p-8 gap-16 sm:p-0 min-h-screen font-[family-name:var(--font-geist-sans) | ||
mx-auto w-full max-w-screen-xl" | ||
> | ||
<div className="flex flex-col gap-8 row-start-2 items-center sm:items-start"> | ||
<h1 className="mb-4 text-4xl font-extrabold leading-none text-gray-800 md:text-5xl lg:text-6xl dark:text-white"> | ||
Case-based explanations - A small demo | ||
</h1> | ||
<InteractiveSection /> | ||
</main> | ||
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center"> | ||
<a | ||
className="flex items-center gap-2 hover:underline hover:underline-offset-4" | ||
href="https://github.com/filipepcampos/case-based-explanations-demo" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<Image | ||
aria-hidden | ||
src="https://nextjs.org/icons/window.svg" | ||
alt="Window icon" | ||
width={16} | ||
height={16} | ||
/> | ||
Github | ||
</a> | ||
</footer> | ||
</div> | ||
<Footer /> | ||
</div> | ||
</main> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { PredictionType } from "./Canvas"; | ||
|
||
export default function Confidence({ result }: { result: PredictionType }) { | ||
return ( | ||
<div> | ||
{(result.prediction || result.prediction === 0) && result.confidence && ( | ||
<div> | ||
<div className="mt-4 text-lg font-bold mb-2">Prediction:</div> | ||
|
||
<div className="flex flex-col md:flex-row md:gap-0 gap-4"> | ||
<div className="text-base"> | ||
You drew the number{" "} | ||
<span className="text-blue-700 dark:text-white"> | ||
{result.prediction} | ||
</span> | ||
. | ||
</div> | ||
<div className="ml-6 flex-1"> | ||
<div className="w-1/2 bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"> | ||
<div | ||
className="bg-blue-600 h-2.5 rounded-full" | ||
style={{ width: result.confidence * 100 + "%" }} | ||
></div> | ||
<div className="flex justify-between mt-1"> | ||
<span className="text-xs text-blue-700 dark:text-white"> | ||
Confidence | ||
</span> | ||
<span className="text-xs text-blue-700 dark:text-white"> | ||
{Math.round(result.confidence * 100)}% | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="mt-8 md:mt-4 text-lg font-bold mb-2"> | ||
Explanations: | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { PredictionType } from "./Canvas"; | ||
import Image from "next/image"; | ||
|
||
export function ExplanationList({ result }: { result: PredictionType }) { | ||
return ( | ||
<div className="flex gap-2 justify-center flex-wrap"> | ||
{result.explanations.map((explanation, index) => ( | ||
<div key={index}> | ||
<span className="mb-1 text-gray-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:text-gray-300"> | ||
{" "} | ||
{"explanation " + (index + 1)} -{" "} | ||
<span className="">{explanation.split("/").at(-2)}</span> | ||
</span> | ||
|
||
<Image | ||
className="dark:invert-0 invert flex-shrink-0 rounded-lg border border-solid border-gray-700 dark:border-white" | ||
src={explanation} | ||
alt="Case-based explanation" | ||
width={150} | ||
height={150} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
export function MockExplanationList() { | ||
return ( | ||
<div className="flex gap-2 justify-center flex-wrap"> | ||
{[...Array(6)].map((explanation, index) => ( | ||
<div key={index}> | ||
<span className="mb-1 text-gray-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:text-gray-300"> | ||
{" "} | ||
{"explanation " + (index + 1)} | ||
</span> | ||
|
||
<div | ||
className="flex items-center justify-center flex-shrink-0 rounded-lg border border-solid border-gray-200 dark:border-white dark:bg-gray-700 animate-pulse" | ||
style={{ width: "150px", height: "150px" }} | ||
> | ||
<svg | ||
className="w-10 h-10 text-gray-200 dark:text-gray-600" | ||
aria-hidden="true" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="currentColor" | ||
viewBox="0 0 20 18" | ||
> | ||
<path d="M18 0H2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2Zm-5.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm4.376 10.481A1 1 0 0 1 16 15H4a1 1 0 0 1-.895-1.447l3.5-7A1 1 0 0 1 7.468 6a.965.965 0 0 1 .9.5l2.775 4.757 1.546-1.887a1 1 0 0 1 1.618.1l2.541 4a1 1 0 0 1 .028 1.011Z" /> | ||
</svg> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.