cagataydag commited on
Commit
81547a2
·
1 Parent(s): e93446d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -411,7 +411,7 @@ with blocks:
411
  blocks.launch(enable_queue=True)
412
 
413
 
414
- """
415
  def my_inference_function(image,text):
416
  img_dir = tempfile.mkdtemp()
417
 
@@ -429,8 +429,15 @@ def my_inference_function(image,text):
429
 
430
  with open(img_path, "wb") as fh:
431
  fh.write(base64.urlsafe_b64decode(image))
432
-
433
- return editor.predict(img_path,[text])
 
 
 
 
 
 
 
434
 
435
  gradio_interface = gr.Interface(
436
  fn = my_inference_function,
@@ -439,7 +446,7 @@ gradio_interface = gr.Interface(
439
  # gr.outputs.Image(type="file"),
440
  )
441
  gradio_interface.launch(enable_queue=True)
442
- """
443
 
444
  #gradio_interface = gr.Interface(
445
  # fn=editor.edit_image,
 
411
  blocks.launch(enable_queue=True)
412
 
413
 
414
+
415
  def my_inference_function(image,text):
416
  img_dir = tempfile.mkdtemp()
417
 
 
429
 
430
  with open(img_path, "wb") as fh:
431
  fh.write(base64.urlsafe_b64decode(image))
432
+
433
+ file = open(img_path, 'rb')
434
+ encoded_data = file.read()
435
+ file.close()
436
+
437
+ print("----- my_inference_function encoded_data -----")
438
+ print(encoded_data)
439
+
440
+ return editor.predict(img_path,[text],edit_choices={'edit_type': 'None', 'pose': 0, 'smile': 0, 'gender': 0, 'age': 0, 'hair_length': 0, 'src_text': '', 'tar_text': '', 'alpha': 1, 'beta': 0.14})
441
 
442
  gradio_interface = gr.Interface(
443
  fn = my_inference_function,
 
446
  # gr.outputs.Image(type="file"),
447
  )
448
  gradio_interface.launch(enable_queue=True)
449
+
450
 
451
  #gradio_interface = gr.Interface(
452
  # fn=editor.edit_image,