Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -114,8 +114,9 @@ def simulate(image0, image1):
|
|
| 114 |
avg_prob = sum(probs) / len(preferences)
|
| 115 |
|
| 116 |
preference = 0 if avg_preference < 0.5 else 1
|
|
|
|
| 117 |
|
| 118 |
-
all_reasons = ' '.join([word.strip() for
|
| 119 |
wordcloud = WordCloud(width = 800, height = 400, background_color ='white').generate(all_reasons)
|
| 120 |
|
| 121 |
plt.figure(figsize=(10,5))
|
|
@@ -128,8 +129,8 @@ def simulate(image0, image1):
|
|
| 128 |
subtitle = "Upload two images of emails and see which is generally preferred by Petco customers!"
|
| 129 |
|
| 130 |
demo = gr.Interface(fn=simulate,
|
| 131 |
-
inputs=[gr.
|
| 132 |
-
gr.
|
| 133 |
outputs=["text",
|
| 134 |
gr.Plot(value=plt)],
|
| 135 |
title="Pairwise Simulation of Petco Email Preference",
|
|
|
|
| 114 |
avg_prob = sum(probs) / len(preferences)
|
| 115 |
|
| 116 |
preference = 0 if avg_preference < 0.5 else 1
|
| 117 |
+
print(preferences, preference)
|
| 118 |
|
| 119 |
+
all_reasons = ' '.join([word.strip() for reasons in data for word in item.split(',')])
|
| 120 |
wordcloud = WordCloud(width = 800, height = 400, background_color ='white').generate(all_reasons)
|
| 121 |
|
| 122 |
plt.figure(figsize=(10,5))
|
|
|
|
| 129 |
subtitle = "Upload two images of emails and see which is generally preferred by Petco customers!"
|
| 130 |
|
| 131 |
demo = gr.Interface(fn=simulate,
|
| 132 |
+
inputs=[gr.File(label="Upload Email 0", file_types=["image"], file_count="single"),
|
| 133 |
+
gr.File(label="Upload Email 1", file_types=["image"], file_count="single")],
|
| 134 |
outputs=["text",
|
| 135 |
gr.Plot(value=plt)],
|
| 136 |
title="Pairwise Simulation of Petco Email Preference",
|