@@ -2,21 +2,22 @@ import React, { useRef } from 'react'
22import clsx from 'clsx'
33import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
44import Layout from '@theme/Layout'
5- import ReactOnnx , { useOnnx } from '@wolanx/react-netron'
65
76import styles from './index.module.css'
7+ import BrowserOnly from '@docusaurus/BrowserOnly'
8+
9+ function MyHome ( ) {
10+ const mod = require ( '@wolanx/react-netron' )
11+ const ReactOnnx = mod . default
12+ const useOnnx = mod . useOnnx
813
9- export default function Home ( ) {
1014 const { siteConfig } = useDocusaurusContext ( )
1115
1216 // https://github.com/onnx/models/blob/main/vision/classification/mnist/model/mnist-12.onnx
1317 const file = useOnnx ( './model/demo.onnx' )
1418 const ref = useRef ( null )
15-
1619 return (
17- < Layout
18- title = { `Hello from ${ siteConfig . title } ` }
19- description = "Description will go into a meta tag in <head />" >
20+ < >
2021 < header className = { clsx ( 'hero hero--primary' , styles . heroBanner ) } >
2122 < div className = "container" >
2223 < h1 className = "hero__title" > { siteConfig . title } </ h1 >
@@ -29,6 +30,20 @@ export default function Home () {
2930 < main >
3031 < ReactOnnx ref = { ref } width = { '100%' } height = { 600 } file = { file } />
3132 </ main >
33+ </ >
34+ )
35+ }
36+
37+ export default function Home ( ) {
38+ const { siteConfig } = useDocusaurusContext ( )
39+
40+ return (
41+ < Layout
42+ title = { `Hello from ${ siteConfig . title } ` }
43+ description = "Description will go into a meta tag in <head />" >
44+ < BrowserOnly fallback = { < div > Loading...</ div > } >
45+ { MyHome }
46+ </ BrowserOnly >
3247 </ Layout >
3348 )
3449}
0 commit comments