Spaces:
Sleeping
Sleeping
Ryan Da commited on
Commit ·
c99cc18
1
Parent(s): 5d96398
fixed rendering issue
Browse files
app.py
CHANGED
|
@@ -1,16 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import os
|
| 3 |
-
|
| 4 |
-
# Read the built React app's index.html
|
| 5 |
-
with open(os.path.join("build", "index.html"), "r") as f:
|
| 6 |
-
html_content = f.read()
|
| 7 |
-
|
| 8 |
-
# Fix asset paths to be relative to /file=build/
|
| 9 |
-
html_content = html_content.replace('"/static/', '"/file=build/static/')
|
| 10 |
-
html_content = html_content.replace('"/manifest.json', '"/file=build/manifest.json')
|
| 11 |
-
html_content = html_content.replace('"/favicon.ico', '"/file=build/favicon.ico')
|
| 12 |
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
-
gr.HTML(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
demo.launch(allowed_paths=["build"])
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
with gr.Blocks() as demo:
|
| 4 |
+
gr.HTML(
|
| 5 |
+
'<iframe src="/file=build/index.html" '
|
| 6 |
+
'width="100%" height="100vh" '
|
| 7 |
+
'style="border:none;width:100%;height:100vh;"></iframe>'
|
| 8 |
+
)
|
| 9 |
|
| 10 |
demo.launch(allowed_paths=["build"])
|
build/asset-manifest.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
-
"main.css": "/static/css/main.8f2b225a.css",
|
| 4 |
-
"main.js": "/static/js/main.
|
| 5 |
-
"static/js/453.42bdce44.chunk.js": "/static/js/453.42bdce44.chunk.js",
|
| 6 |
-
"index.html": "/index.html",
|
| 7 |
-
"main.8f2b225a.css.map": "/static/css/main.8f2b225a.css.map",
|
| 8 |
-
"main.
|
| 9 |
-
"453.42bdce44.chunk.js.map": "/static/js/453.42bdce44.chunk.js.map"
|
| 10 |
},
|
| 11 |
"entrypoints": [
|
| 12 |
"static/css/main.8f2b225a.css",
|
| 13 |
-
"static/js/main.
|
| 14 |
]
|
| 15 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
+
"main.css": "./static/css/main.8f2b225a.css",
|
| 4 |
+
"main.js": "./static/js/main.42eedb35.js",
|
| 5 |
+
"static/js/453.42bdce44.chunk.js": "./static/js/453.42bdce44.chunk.js",
|
| 6 |
+
"index.html": "./index.html",
|
| 7 |
+
"main.8f2b225a.css.map": "./static/css/main.8f2b225a.css.map",
|
| 8 |
+
"main.42eedb35.js.map": "./static/js/main.42eedb35.js.map",
|
| 9 |
+
"453.42bdce44.chunk.js.map": "./static/js/453.42bdce44.chunk.js.map"
|
| 10 |
},
|
| 11 |
"entrypoints": [
|
| 12 |
"static/css/main.8f2b225a.css",
|
| 13 |
+
"static/js/main.42eedb35.js"
|
| 14 |
]
|
| 15 |
}
|
build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.
|
|
|
|
| 1 |
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>React App</title><script defer="defer" src="./static/js/main.42eedb35.js"></script><link href="./static/css/main.8f2b225a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
build/static/js/{main.d5150984.js → main.42eedb35.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
build/static/js/{main.d5150984.js.LICENSE.txt → main.42eedb35.js.LICENSE.txt}
RENAMED
|
File without changes
|
build/static/js/{main.d5150984.js.map → main.42eedb35.js.map}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
"name": "react-template",
|
| 3 |
"version": "0.1.0",
|
| 4 |
"private": true,
|
|
|
|
| 5 |
"dependencies": {
|
| 6 |
"@testing-library/dom": "^10.4.0",
|
| 7 |
"@testing-library/jest-dom": "^6.6.3",
|
|
|
|
| 2 |
"name": "react-template",
|
| 3 |
"version": "0.1.0",
|
| 4 |
"private": true,
|
| 5 |
+
"homepage": ".",
|
| 6 |
"dependencies": {
|
| 7 |
"@testing-library/dom": "^10.4.0",
|
| 8 |
"@testing-library/jest-dom": "^6.6.3",
|