Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,8 @@ user_agents = dataset['train'].to_pandas()
|
|
21 |
user_agents = user_agents.iloc[:,1:]
|
22 |
user_batch = user_agents[:10]
|
23 |
|
|
|
|
|
24 |
def create_description(row):
|
25 |
description = (
|
26 |
f"Imagine that you are currently {int(row['age'])} years old. You have {int(row['num_pets'])} pets "
|
@@ -83,7 +85,7 @@ def query_agent(description, question, image0, image1):
|
|
83 |
print(f"Failed to analyze {image0} and {image1} after 3 attempts.")
|
84 |
return None, None
|
85 |
|
86 |
-
def simulate(
|
87 |
preferences = []
|
88 |
reasons = []
|
89 |
probs = []
|
@@ -111,9 +113,7 @@ def simulate(user_batch, question, image0, image1):
|
|
111 |
subtitle = "Upload two images of emails and see which is generally preferred by Petco customers!"
|
112 |
|
113 |
demo = gr.Interface(fn=simulate,
|
114 |
-
inputs=[
|
115 |
-
question,
|
116 |
-
gr.UploadButton("Click to Upload Email 0", file_types=["image"], file_count="1"),
|
117 |
gr.UploadButton("Click to Upload Email 1", file_types=["image"], file_count="1")],
|
118 |
outputs="text",
|
119 |
title="Pairwise Simulation of Petco Email Preference",
|
|
|
21 |
user_agents = user_agents.iloc[:,1:]
|
22 |
user_batch = user_agents[:10]
|
23 |
|
24 |
+
print(user_batch)
|
25 |
+
|
26 |
def create_description(row):
|
27 |
description = (
|
28 |
f"Imagine that you are currently {int(row['age'])} years old. You have {int(row['num_pets'])} pets "
|
|
|
85 |
print(f"Failed to analyze {image0} and {image1} after 3 attempts.")
|
86 |
return None, None
|
87 |
|
88 |
+
def simulate(image0, image1):
|
89 |
preferences = []
|
90 |
reasons = []
|
91 |
probs = []
|
|
|
113 |
subtitle = "Upload two images of emails and see which is generally preferred by Petco customers!"
|
114 |
|
115 |
demo = gr.Interface(fn=simulate,
|
116 |
+
inputs=[gr.UploadButton("Click to Upload Email 0", file_types=["image"], file_count="1"),
|
|
|
|
|
117 |
gr.UploadButton("Click to Upload Email 1", file_types=["image"], file_count="1")],
|
118 |
outputs="text",
|
119 |
title="Pairwise Simulation of Petco Email Preference",
|