clarice7 commited on
Commit
966c960
1 Parent(s): 5118de4

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +8 -26
  2. requirements.txt +1 -2
app.py CHANGED
@@ -84,6 +84,7 @@ def query_agent(description, question, image0, image1):
84
  return None, None
85
 
86
  def simulate(image0, image1):
 
87
  preferences = []
88
  reasons = []
89
  probs = []
@@ -110,32 +111,13 @@ def simulate(image0, image1):
110
 
111
  subtitle = "Upload two images of emails and see which is generally preferred by Petco customers!"
112
 
113
-
114
- from pathlib import Path
115
-
116
- def upload_file(filepath):
117
- name = Path(filepath).name
118
- return [gr.UploadButton(visible=False), gr.DownloadButton(label=f"Download {name}", value=filepath, visible=True)]
119
-
120
- def download_file():
121
- return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
122
-
123
- with gr.Blocks() as demo:
124
- gr.Markdown("First upload a file and and then you'll be able download it (but only once!)")
125
- with gr.Row():
126
- u = gr.UploadButton("Upload a file", file_count="single")
127
- d = gr.DownloadButton("Download the file", visible=False)
128
-
129
- u.upload(upload_file, u, [u, d])
130
- d.click(download_file, None, [u, d])
131
-
132
- # demo = gr.Interface(fn=simulate,
133
- # inputs=[gr.UploadButton("Click to Upload Email 0", file_types=["image"], file_count="single"),
134
- # gr.UploadButton("Click to Upload Email 1", file_types=["image"], file_count="single")],
135
- # outputs="text",
136
- # title="Pairwise Simulation of Petco Email Preference",
137
- # description=subtitle
138
- # )
139
 
140
  if __name__ == "__main__":
141
  demo.launch()
 
84
  return None, None
85
 
86
  def simulate(image0, image1):
87
+ print(image0, image1)
88
  preferences = []
89
  reasons = []
90
  probs = []
 
111
 
112
  subtitle = "Upload two images of emails and see which is generally preferred by Petco customers!"
113
 
114
+ demo = gr.Interface(fn=simulate,
115
+ inputs=[gr.UploadButton("Click to Upload Email 0", file_types=["image"], file_count="single"),
116
+ gr.UploadButton("Click to Upload Email 1", file_types=["image"], file_count="single")],
117
+ outputs="text",
118
+ title="Pairwise Simulation of Petco Email Preference",
119
+ description=subtitle
120
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
  if __name__ == "__main__":
123
  demo.launch()
requirements.txt CHANGED
@@ -2,5 +2,4 @@ openai
2
  https://gradio-builds.s3.amazonaws.com/75ed61524f55e542414d165ed60a976091c24f77/gradio-3.16.2-py3-none-any.whl
3
  pandas
4
  numpy
5
- datasets
6
- pathlib
 
2
  https://gradio-builds.s3.amazonaws.com/75ed61524f55e542414d165ed60a976091c24f77/gradio-3.16.2-py3-none-any.whl
3
  pandas
4
  numpy
5
+ datasets