Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
-
|
| 4 |
import cv2
|
| 5 |
from google_img_source_search import ReverseImageSearcher
|
| 6 |
from PIL import Image
|
| 7 |
-
|
| 8 |
import os
|
| 9 |
import uuid
|
| 10 |
uid=uuid.uuid4()
|
|
@@ -15,7 +14,19 @@ size_js="""
|
|
| 15 |
var realHeight = myImg.naturalHeight;
|
| 16 |
alert("Original width=" + realWidth + ", " + "Original height=" + realHeight);
|
| 17 |
}"""
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
def process_vid(file):
|
| 21 |
new_video_in = str(file)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
+
import yt_dlp
|
| 4 |
import cv2
|
| 5 |
from google_img_source_search import ReverseImageSearcher
|
| 6 |
from PIL import Image
|
|
|
|
| 7 |
import os
|
| 8 |
import uuid
|
| 9 |
uid=uuid.uuid4()
|
|
|
|
| 14 |
var realHeight = myImg.naturalHeight;
|
| 15 |
alert("Original width=" + realWidth + ", " + "Original height=" + realHeight);
|
| 16 |
}"""
|
| 17 |
+
def dl(inp):
|
| 18 |
+
out = None
|
| 19 |
+
out_file=[]
|
| 20 |
+
try:
|
| 21 |
+
inp_out=inp.replace("https://","")
|
| 22 |
+
inp_out=inp_out.replace("/","_").replace(".","_").replace("=","_").replace("?","_")
|
| 23 |
+
os.system(f'yt-dlp "{inp}" --trim-filenames 160 -o "{inp_out}.mp4" -S res,mp4 --recode mp4')
|
| 24 |
+
out_f = f"{inp_out}.mp4"
|
| 25 |
+
out_ap = os.path.abspath(out_f)
|
| 26 |
+
out = f'https://omnibus-reverse-image.hf.space/file={out_ap}'
|
| 27 |
+
except Exception as e:
|
| 28 |
+
out = f'{e}'
|
| 29 |
+
return out
|
| 30 |
|
| 31 |
def process_vid(file):
|
| 32 |
new_video_in = str(file)
|