mzltest commited on
Commit
1ef4a5c
·
1 Parent(s): f86e030

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -11,7 +11,7 @@ from logmmse import logmmse
11
  from typing import Tuple
12
  import time
13
  import requests
14
- import os
15
  from urllib.parse import quote
16
 
17
  logging.getLogger('numba').setLevel(logging.WARNING)
@@ -111,17 +111,11 @@ def downloadTubeUpload(query):
111
  "Content-Disposition": f"attachment; filename={video_id}.mp4"
112
  }
113
 
114
- with requests.get(best_audio_format["url"], stream=True) as r:
115
- r.raise_for_status()
116
- with open("temp.mp4", "wb") as f:
117
- for chunk in r.iter_content(chunk_size=8192):
118
- f.write(chunk)
119
-
120
- with open("temp.mp4", "rb") as f:
121
- files = {"file": ("temp.mp4", f, "multipart/form-data")}
122
- response = requests.post(upload_url, headers=headers, files=files)
123
- upload_response = response.json()
124
-
125
  return upload_response.get("result", {}).get("id")
126
  def split_file(file_id):
127
  url_for_split = "https://www.lalal.ai/api/preview/"
 
11
  from typing import Tuple
12
  import time
13
  import requests
14
+ import os,json
15
  from urllib.parse import quote
16
 
17
  logging.getLogger('numba').setLevel(logging.WARNING)
 
111
  "Content-Disposition": f"attachment; filename={video_id}.mp4"
112
  }
113
 
114
+ command = f"wget {best_audio_format["url"]} -O temp.mp4"
115
+ os.system(command)
116
+ command= f'curl --url https://www.lalal.ai/api/upload/ --data-binary @temp.mp4 --header "Content-Disposition: attachment; filename=temp.mp4"'
117
+ output=os.getoutput(command)
118
+ upload_response=json.loads(output)
 
 
 
 
 
 
119
  return upload_response.get("result", {}).get("id")
120
  def split_file(file_id):
121
  url_for_split = "https://www.lalal.ai/api/preview/"