microbamboo commited on
Commit
8b4279a
·
verified ·
1 Parent(s): 475c9e0

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -4,7 +4,9 @@ import time
4
  import uuid
5
  import hashlib
6
  import subprocess
 
7
  from flask import Flask, request, send_file
 
8
  MAX_SECONDS = 100
9
  server_me = 'https://zaisheng-testapi.hf.space'
10
 
@@ -95,10 +97,18 @@ def putvideo():
95
  h = request.headers
96
  key = h['Key']
97
  file = h['File']
 
 
 
98
  if not get_key_sha256(key) == match_sha256:
99
  return 'err'
100
  f = request.files['file']
101
- f.save(os.path.join(video_folder, file+'.mp4'))
 
 
 
 
 
102
  return "ok"
103
 
104
 
 
4
  import uuid
5
  import hashlib
6
  import subprocess
7
+ import huggingface as hh
8
  from flask import Flask, request, send_file
9
+
10
  MAX_SECONDS = 100
11
  server_me = 'https://zaisheng-testapi.hf.space'
12
 
 
97
  h = request.headers
98
  key = h['Key']
99
  file = h['File']
100
+ repo_id_video = h['RV']
101
+ repo_id_prompt = h['RP']
102
+ tt = h['tt']
103
  if not get_key_sha256(key) == match_sha256:
104
  return 'err'
105
  f = request.files['file']
106
+ local_file_video = os.path.join(video_folder, file+'.mp4')
107
+ local_file_prompt = os.path.join(prompt_folder, file)
108
+ f.save(local_file_video)
109
+ hh.upload_file(path_or_fileobj=local_file_video, path_in_repo=file+'.mp4', repo_id=repo_id_video, repo_type='dataset', token=tt)
110
+ hh.upload_file(path_or_fileobj=local_file_prompt, path_in_repo=file, repo_id=repo_id_prompt, repo_type='dataset', token=tt)
111
+
112
  return "ok"
113
 
114