-
Notifications
You must be signed in to change notification settings - Fork 14
/
feed.tsx
40 lines (37 loc) · 1.34 KB
/
feed.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import FeatureInfo from "./components/featureInfo"
import React, { useEffect } from "react"
import Welcome from "./welcome"
import { Feature } from "./types"
import FeatureSelect from "./components/featureSelect"
import { useState } from "react"
import { useParams, useNavigate, Link } from "react-router-dom"
import { pathForFeature, DEFAULT_AUTOENCODER, AUTOENCODER_FAMILIES } from "./autoencoder_registry"
export default function Feed() {
const params = useParams();
const navigate = useNavigate();
let family = AUTOENCODER_FAMILIES[params.family || DEFAULT_AUTOENCODER.family];
let feature: Feature = {
// "layer": parseInt(params.layer),
"atom": parseInt(params.atom),
"autoencoder": family.get_ae(params),
};
console.log('feature', JSON.stringify(feature, null, 2))
return (
<div>
<div>
<h2 className="flex flex-row">
<Link to="/">SAE viewer</Link>
</h2>
<FeatureSelect
init_feature={feature}
onFeatureChange={(f: Feature) => navigate(pathForFeature(f, {replace: true}))}
onFeatureSubmit={(f: Feature) => navigate(pathForFeature(f, {replace: true}))}
/>
</div>
<br/>
<div style={{ width: '100%', padding: '', margin: "auto", overflow: "visible" }}>
<FeatureInfo feature={feature}/>
</div>
</div>
)
}