fffiloni commited on
Commit
365a997
·
1 Parent(s): 5c3a27a

Update share_btn.py

Browse files
Files changed (1) hide show
  1. share_btn.py +15 -1
share_btn.py CHANGED
@@ -32,9 +32,23 @@ share_js = """async () => {
32
  const videoBlob = new File([blob], fileName, { type: 'video/mp4' });
33
 
34
  console.log(videoBlob);
 
 
 
 
35
  return videoBlob;
36
 
37
  }
 
 
 
 
 
 
 
 
 
 
38
 
39
  //const gradioEl = document.querySelector('body > gradio-app');
40
  const gradioEl = document.querySelector("gradio-app").shadowRoot;
@@ -64,7 +78,7 @@ share_js = """async () => {
64
  loadingIconEl.style.removeProperty('display');
65
 
66
  const videoFile = await getOutputVideoFile(outputVideo, outputVideo_name);
67
- const dataOutputVideo = await uploadFile(outputVideo_src);
68
 
69
 
70
 
 
32
  const videoBlob = new File([blob], fileName, { type: 'video/mp4' });
33
 
34
  console.log(videoBlob);
35
+
36
+ video64 = videoToBase64(videoBlob)
37
+ console.log(video64)
38
+
39
  return videoBlob;
40
 
41
  }
42
+
43
+ async function videoToBase64(videoFile) {
44
+ return new Promise((resolve, reject) => {
45
+ let reader = new FileReader();
46
+ reader.readAsDataURL(videoFile);
47
+ reader.onload = () => resolve(reader.result);
48
+ reader.onerror = error => reject(error);
49
+
50
+ });
51
+ }
52
 
53
  //const gradioEl = document.querySelector('body > gradio-app');
54
  const gradioEl = document.querySelector("gradio-app").shadowRoot;
 
78
  loadingIconEl.style.removeProperty('display');
79
 
80
  const videoFile = await getOutputVideoFile(outputVideo, outputVideo_name);
81
+ const dataOutputVideo = await uploadFile(videoFile);
82
 
83
 
84