fix static path

This commit is contained in:
Ali 2021-12-27 11:20:21 -08:00
parent 8712ffc069
commit f1d2152585
4 changed files with 14 additions and 9 deletions

View File

@ -1,7 +1,7 @@
if (window.gradio_mode === "app") {
__webpack_public_path__ = "/";
__webpack_public_path__ = "";
} else if (window.gradio_mode === "website") {
__webpack_public_path__ = "gradio_static/"
__webpack_public_path__ = "/gradio_static/"
} else {
__webpack_public_path__ = "https://gradio.s3-us-west-2.amazonaws.com/" + process.env.REACT_APP_VERSION + "/";
}

View File

@ -28,7 +28,8 @@ RUN npm install
RUN npm run build
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
RUN cp -r /gradio/gradio/templates/frontend/static ./gradio_static
RUN mkdir ./gradio_static/
RUN cp -r /gradio/gradio/templates/frontend/static ./gradio_static/static
RUN cp -r /gradio/website/homepage/dist/. ./
RUN cp /gradio/website/homepage/nginx.conf /etc/nginx/conf.d/default.conf

View File

@ -20,7 +20,7 @@
<meta name="twitter:image" content="https://gradio.app/static/home/img/social-cheetah.jpg">
<link rel="icon" type="image/png" href="/assets/img/logo.png">
<link href="/gradio_static/bundle.css" rel="stylesheet">
<link href="/gradio_static/static/bundle.css" rel="stylesheet">
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="/assets/prism.css">
<style>
@ -121,7 +121,10 @@
</div>
</footer>
<script src="/assets/prism.js"></script>
<script defer id='gradio-library' src="/gradio_static/bundle.js"></script>
<script>
window.gradio_mode = "website";
</script>
<script defer id='gradio-library' src="/gradio_static/static/bundle.js"></script>
<script>
var demo_endpoint = "/demo";
var demo_names = {{ demo_names|tojson }};

View File

@ -20,7 +20,7 @@
<meta name="twitter:image" content="https://gradio.app/static/home/img/social-cheetah.jpg">
<link rel="icon" type="image/png" href="/assets/img/logo.png">
<link href="/gradio_static/bundle.css" rel="stylesheet">
<link href="/gradio_static/static/bundle.css" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="/assets/prism.css">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"></script>
@ -310,8 +310,7 @@ iface <span class="token operator">=</span> gr<span class="token punctuation">.<
}
}
xhr.send();
</script>
<script>
let load_demo = demo_id => {
document.querySelectorAll(".demotab").forEach(demotab => {
demotab.classList.remove("selected");
@ -322,8 +321,10 @@ iface <span class="token operator">=</span> gr<span class="token punctuation">.<
document.querySelector(`.demotab[demo='${demo_id}']`).classList.add("selected");
document.querySelector(`.demo[demo='${demo_id}']`).classList.remove("hidden");
}
window.gradio_mode = "website";
</script>
<script defer id='gradio-library' src="/gradio_static/bundle.js"></script>
<script defer id='gradio-library' src="/gradio_static/static/bundle.js"></script>
<script>
document.querySelector("#gradio-library").addEventListener('load', function () {
launchGradioFromSpaces("abidlabs/Draw", "#demo_mnist");