SuriRaja commited on
Commit
b2992e3
1 Parent(s): dce33d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -7,8 +7,9 @@ import torch
7
  import torchvision.transforms as transforms
8
  from transformers import pipeline
9
 
10
- # Load the DeepVTO model from Hugging Face
11
- deepvto_pipeline = pipeline("image-to-image", model="huggingface/deepvto")
 
12
 
13
  # Load sample product data
14
  product_data = pd.DataFrame({
@@ -31,16 +32,12 @@ def process_image(image, product):
31
 
32
  garment_image = Image.open(garment_path).convert("RGB")
33
 
34
- # Convert images to the format required by the model
35
- person_image_tensor = transforms.ToTensor()(person_image).unsqueeze(0)
36
- garment_image_tensor = transforms.ToTensor()(garment_image).unsqueeze(0)
37
 
38
- # Run the DeepVTO model
39
- with torch.no_grad():
40
- output = deepvto_pipeline(person_image_tensor, garment_image_tensor)
41
-
42
- # Convert the output to a PIL image
43
- output_image = transforms.ToPILImage()(output[0])
44
 
45
  # Convert to numpy array for Gradio
46
  result_array = np.array(output_image)
 
7
  import torchvision.transforms as transforms
8
  from transformers import pipeline
9
 
10
+ # Load the Rao's Virtual Try-On model from Hugging Face
11
+ model_id = "gouthaml/raos-virtual-try-on-model"
12
+ tryon_pipeline = pipeline("image-to-image", model=model_id)
13
 
14
  # Load sample product data
15
  product_data = pd.DataFrame({
 
32
 
33
  garment_image = Image.open(garment_path).convert("RGB")
34
 
35
+ # Run the virtual try-on model
36
+ inputs = {"image": person_image, "garment": garment_image}
37
+ result = tryon_pipeline(inputs)
38
 
39
+ # Post-process the output
40
+ output_image = result[0] # Assuming the model returns a list of outputs
 
 
 
 
41
 
42
  # Convert to numpy array for Gradio
43
  result_array = np.array(output_image)