NeeravS commited on
Commit
b2ebbba
·
verified ·
1 Parent(s): caa56d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -156,6 +156,10 @@ def verify_captcha(user_input, captcha_solution):
156
 
157
  @spaces.GPU(duration=1000)
158
  def analyze_video(video_file, captcha_input, captcha_solution, request: gr.Request):
 
 
 
 
159
  client_ip = get_client_ip(request)
160
 
161
  # Check if IP is blocked
@@ -194,13 +198,9 @@ def analyze_video(video_file, captcha_input, captcha_solution, request: gr.Reque
194
  }
195
  return output
196
 
197
- if not is_authorized(request):
198
- return {"error": "Unauthorized access. Please provide a valid API key."}
199
-
200
  except Exception as e:
201
  logging.error(f"Error during analysis: {e}")
202
  return {"error": "An error occurred during video analysis. Please check your input and try again."}
203
-
204
 
205
  # Interface with CAPTCHA after video upload
206
  def main_interface():
 
156
 
157
  @spaces.GPU(duration=1000)
158
  def analyze_video(video_file, captcha_input, captcha_solution, request: gr.Request):
159
+ # Authorization check
160
+ if not is_authorized(request):
161
+ return {"error": "Unauthorized access. Please provide a valid API key."}
162
+
163
  client_ip = get_client_ip(request)
164
 
165
  # Check if IP is blocked
 
198
  }
199
  return output
200
 
 
 
 
201
  except Exception as e:
202
  logging.error(f"Error during analysis: {e}")
203
  return {"error": "An error occurred during video analysis. Please check your input and try again."}
 
204
 
205
  # Interface with CAPTCHA after video upload
206
  def main_interface():