radames commited on
Commit
8e6b896
1 Parent(s): 96d8926

add limits

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -103,7 +103,18 @@ def update(files, prompt, top_p=1, temperature=1):
103
  raise gr.Error("Please enter a prompt.")
104
 
105
  files_info = get_files_infos(files)
106
-
 
 
 
 
 
 
 
 
 
 
 
107
  try:
108
  command_string = get_completion(prompt, files_info, top_p, temperature)
109
  print(
 
103
  raise gr.Error("Please enter a prompt.")
104
 
105
  files_info = get_files_infos(files)
106
+ # disable this if you're running the app locally or on your own server
107
+ for file_info in files_info:
108
+ if file_info["type"] == "video":
109
+ duration = int(file_info["duration"].split("s")[0])
110
+ if duration > 60:
111
+ raise gr.Error(
112
+ "Please make sure all videos are less than 1 minute long."
113
+ )
114
+ if file_info["size"] > 10000000:
115
+ raise gr.Error(
116
+ "Please make sure all files are less than 10MB in size."
117
+ )
118
  try:
119
  command_string = get_completion(prompt, files_info, top_p, temperature)
120
  print(