santhosh97 commited on
Commit
1d53e45
·
1 Parent(s): 259a26a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -25
app.py CHANGED
@@ -37,16 +37,6 @@ _S3_PATH_OUTPUT = "s3://gretel-image-synthetics-use2/data/{identifier}/{image_ty
37
  # Command-line arguments to control some stuff for easier local testing.
38
  # Eventually may want to move everything into functions and have a
39
  # if __name__ == "main" setup instead of everything inline.
40
- parser = argparse.ArgumentParser()
41
- parser.add_argument(
42
- "--dry-run", action="store_true",
43
- help="Skip sending train request to backend server.",
44
- )
45
- parser.add_argument(
46
- "--train-endpoint-url", default=None,
47
- help="URL of backend server to send train request to. If None, use hardcoded banana setup.",
48
- )
49
- cli_args = parser.parse_args()
50
 
51
  if "key" not in st.session_state:
52
  st.session_state["key"] = uuid.uuid4().hex
@@ -242,20 +232,11 @@ def verify_captcha(captcha_id, captcha_response):
242
  return {"error": "Failed to verify captcha"}
243
 
244
  def train_model(model_inputs):
245
- if cli_args.dry_run:
246
- logger.info("Skipping model training since --dry-run is enabled.")
247
- logger.info(f"model_inputs: {model_inputs}")
248
- return
249
-
250
- if cli_args.train_endpoint_url is None:
251
- # Use banana backend
252
- api_key = "03cdd72e-5c04-4207-bd6a-fd5712c1740e"
253
- model_key = "1a3b4ce5-164f-4efb-9f4a-c2ad3a930d0b"
254
- st.markdown(str(model_inputs))
255
- _ = banana.run(api_key, model_key, model_inputs)
256
- else:
257
- # Send request directly to specified url
258
- _ = requests.post(cli_args.train_endpoint_url, json=model_inputs)
259
 
260
  if st.session_state["email_provided"]:
261
  user_email_input = st.empty()
@@ -324,7 +305,6 @@ if st.session_state["login"]:
324
  }
325
  st.session_state["model_inputs"] = {
326
  "superhero_file_path": dictionary[img][0],
327
- # Use presigned url since backend does not have credentials
328
  "person_file_path": generate_s3_get_url(st.session_state["s3_face_file_path"], expiration_seconds=3600),
329
  "superhero_prompt": dictionary[img][1],
330
  "num_images": 50,
 
37
  # Command-line arguments to control some stuff for easier local testing.
38
  # Eventually may want to move everything into functions and have a
39
  # if __name__ == "main" setup instead of everything inline.
 
 
 
 
 
 
 
 
 
 
40
 
41
  if "key" not in st.session_state:
42
  st.session_state["key"] = uuid.uuid4().hex
 
232
  return {"error": "Failed to verify captcha"}
233
 
234
  def train_model(model_inputs):
235
+ # Use banana backend
236
+ api_key = "03cdd72e-5c04-4207-bd6a-fd5712c1740e"
237
+ model_key = "1a3b4ce5-164f-4efb-9f4a-c2ad3a930d0b"
238
+ #st.markdown(str(model_inputs))
239
+ _ = banana.run(api_key, model_key, model_inputs)
 
 
 
 
 
 
 
 
 
240
 
241
  if st.session_state["email_provided"]:
242
  user_email_input = st.empty()
 
305
  }
306
  st.session_state["model_inputs"] = {
307
  "superhero_file_path": dictionary[img][0],
 
308
  "person_file_path": generate_s3_get_url(st.session_state["s3_face_file_path"], expiration_seconds=3600),
309
  "superhero_prompt": dictionary[img][1],
310
  "num_images": 50,