diff --git a/.gitignore b/.gitignore index 9db87a3..0ba644b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ transformerviz.egg-info node_modules/ +dist/ +env/ __pycache__ *.pyc diff --git a/frontend/app.css b/frontend/app.css index 5390aae..16a92c4 100644 --- a/frontend/app.css +++ b/frontend/app.css @@ -6,46 +6,6 @@ body { min-height: 100%; } -.button { - position: relative; - display: inline-block; -} - -.container { - display: grid; - grid-template-columns: 1fr 3fr; - grid-template-rows: 1fr; - padding-left: 24px; - padding-right: 24px; - padding-top: 36px; - padding-bottom: 36px; - background-color: #F3F6FD; -} - -.text-result { - padding: 10px; - background-color: #F3F6FD; -} - -.text-result-content { - margin-left: 10px; - overflow: hidden; - flex-grow: 1; -} - -.text-result-content-score { - margin-left: 10px; - overflow: hidden; - flex-grow: 1; -} - -.text-result-content-generated-text { - margin-left: 10px; - overflow: hidden; - flex-grow: 1; - font-style: bold; -} - .bar { fill: rgba(252, 84, 104, 1); } @@ -54,3 +14,9 @@ body { stroke-width: 2px; stroke: rgb(0,0,0, 1); } + +h1 { + font-size: 20px; + font-weight: 600; + line-height: 20px; +} diff --git a/frontend/components/TextDetailedAnalysis.tsx b/frontend/components/TextDetailedAnalysis.tsx index b88e979..e3de57d 100644 --- a/frontend/components/TextDetailedAnalysis.tsx +++ b/frontend/components/TextDetailedAnalysis.tsx @@ -3,8 +3,8 @@ import * as d3 from "d3"; import * as _ from "lodash" import ReactDOM from "react-dom"; import AnalyzedText from "../models/AnalyzedText"; -import {BiEdit} from "react-icons/bi"; import PerspectiveScoresSpiderChart from "./PerspectiveScoresSpiderChart"; +import { FiEdit } from "react-icons/fi"; type TextDetailedAnalysisProps = { selectedText: AnalyzedText[], @@ -20,7 +20,8 @@ class TextGenerationResults extends React.Component +
+

Toxicity Analysis

{this.props.selectedText.map((item, index) => -
+
{item.id}
@@ -46,7 +47,7 @@ class TextGenerationResults extends React.Component
- +
)} diff --git a/frontend/components/TextGenerationControl.tsx b/frontend/components/TextGenerationControl.tsx index 44e2adf..5496841 100644 --- a/frontend/components/TextGenerationControl.tsx +++ b/frontend/components/TextGenerationControl.tsx @@ -4,6 +4,7 @@ import { Fabric } from "office-ui-fabric-react/lib/Fabric"; import { TextField } from "office-ui-fabric-react/lib/TextField"; import { PrimaryButton } from "office-ui-fabric-react/lib/Button"; import { Checkbox, Stack, Slider } from "office-ui-fabric-react"; +import { FiChevronUp, FiChevronDown } from "react-icons/fi"; type TextGenerationControlProps = { generateText: Function; @@ -14,6 +15,7 @@ type TextGenerationControlState = { model: string; doSample: boolean; earlyStopping: boolean; + isFolded: boolean; minLength: number; maxLength: number; topK: number; @@ -33,11 +35,12 @@ class TextGenerationControl extends React.Component< model: "gpt2", doSample: false, earlyStopping: false, + isFolded: false, minLength: 10, maxLength: 20, topK: 50, - topP: 1.0, - temperature: 1.0, + topP: 0.0, + temperature: 0.0, numBeams: 1, }; } @@ -117,80 +120,120 @@ class TextGenerationControl extends React.Component< }); }; + toggleFold = () => { + this.setState({ + isFolded: !this.state.isFolded + }); + } + render() { - return ( -
-
- - + if (this.state.isFolded) { + return ( +
+
+

Text Generation Prompt

+ +
+
-
- - - - - - - - + ) + } else { + return ( +
+
+ + +
+
+ + + + + + + + +
+
-
- ); + ); + } } } diff --git a/frontend/components/TextGenerationResults.tsx b/frontend/components/TextGenerationResults.tsx index 8af9d8a..72d8247 100644 --- a/frontend/components/TextGenerationResults.tsx +++ b/frontend/components/TextGenerationResults.tsx @@ -56,9 +56,9 @@ class TextGenerationResults extends React.Component -

Generated Results

+

Generated Results

{this.props.analysisResults.map((item) => -
+
{item.id}
diff --git a/frontend/index.tsx b/frontend/index.tsx index 7316025..5e73731 100644 --- a/frontend/index.tsx +++ b/frontend/index.tsx @@ -8,8 +8,8 @@ import { createLogger } from 'redux-logger'; import thunkMiddleware from 'redux-thunk'; import { initializeIcons } from 'office-ui-fabric-react/lib/Icons'; -import "./app.css"; import "./tailwind.css"; +import "./app.css"; const loggerMiddleware = createLogger() const store = createStore(rootReducer, applyMiddleware(thunkMiddleware, loggerMiddleware));