Update share_btn.py
Browse files- share_btn.py +2 -11
share_btn.py
CHANGED
@@ -25,7 +25,7 @@ share_js = """async () => {
|
|
25 |
|
26 |
async function getOutputVideoFile(videoURL){
|
27 |
|
28 |
-
fetch(
|
29 |
.then(response => response.blob())
|
30 |
.then(blob => {
|
31 |
// do something with the blob;
|
@@ -37,21 +37,16 @@ share_js = """async () => {
|
|
37 |
});
|
38 |
|
39 |
}
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
|
45 |
//const gradioEl = document.querySelector('body > gradio-app');
|
46 |
const gradioEl = document.querySelector("gradio-app").shadowRoot;
|
47 |
|
48 |
const whisper_input = gradioEl.querySelector('#text_inp textarea').value;
|
49 |
-
|
50 |
const outputVideo = gradioEl.querySelector('#video_out video');
|
51 |
const outputVideo_src = gradioEl.querySelector('#video_out video').src;
|
52 |
const outputVideo_name = outputVideo_src.split('/').pop();
|
53 |
-
|
54 |
-
const video_url = "https://fffiloni-one-shot-talking-face.hf.space/file=/tmp/" + outputVideo_name;
|
55 |
|
56 |
let titleTxt = outputVideo_name;
|
57 |
|
@@ -66,22 +61,18 @@ share_js = """async () => {
|
|
66 |
if(!outputVideo){
|
67 |
return;
|
68 |
};
|
69 |
-
|
70 |
shareBtnEl.style.pointerEvents = 'none';
|
71 |
shareIconEl.style.display = 'none';
|
72 |
loadingIconEl.style.removeProperty('display');
|
73 |
|
74 |
const videoFile = await getOutputVideoFile(video_url);
|
75 |
const dataOutputVideo = await uploadFile(videoFile);
|
76 |
-
|
77 |
|
78 |
|
79 |
const descriptionMd = `
|
80 |
#### What i asked for:
|
81 |
${whisper_input}
|
82 |
-
|
83 |
#### Video:
|
84 |
-
|
85 |
<video controls>
|
86 |
<source src="${dataOutputVideo}" type="video/mp4">
|
87 |
Your browser does not support the video element.
|
|
|
25 |
|
26 |
async function getOutputVideoFile(videoURL){
|
27 |
|
28 |
+
fetch(videoURL, { mode: 'no-cors'})
|
29 |
.then(response => response.blob())
|
30 |
.then(blob => {
|
31 |
// do something with the blob;
|
|
|
37 |
});
|
38 |
|
39 |
}
|
|
|
|
|
|
|
40 |
|
41 |
|
42 |
//const gradioEl = document.querySelector('body > gradio-app');
|
43 |
const gradioEl = document.querySelector("gradio-app").shadowRoot;
|
44 |
|
45 |
const whisper_input = gradioEl.querySelector('#text_inp textarea').value;
|
|
|
46 |
const outputVideo = gradioEl.querySelector('#video_out video');
|
47 |
const outputVideo_src = gradioEl.querySelector('#video_out video').src;
|
48 |
const outputVideo_name = outputVideo_src.split('/').pop();
|
49 |
+
const video_url = `https://fffiloni-one-shot-talking-face.hf.space/file=/tmp/${outputVideo_name}`;
|
|
|
50 |
|
51 |
let titleTxt = outputVideo_name;
|
52 |
|
|
|
61 |
if(!outputVideo){
|
62 |
return;
|
63 |
};
|
|
|
64 |
shareBtnEl.style.pointerEvents = 'none';
|
65 |
shareIconEl.style.display = 'none';
|
66 |
loadingIconEl.style.removeProperty('display');
|
67 |
|
68 |
const videoFile = await getOutputVideoFile(video_url);
|
69 |
const dataOutputVideo = await uploadFile(videoFile);
|
|
|
70 |
|
71 |
|
72 |
const descriptionMd = `
|
73 |
#### What i asked for:
|
74 |
${whisper_input}
|
|
|
75 |
#### Video:
|
|
|
76 |
<video controls>
|
77 |
<source src="${dataOutputVideo}" type="video/mp4">
|
78 |
Your browser does not support the video element.
|