epochs-demos commited on
Commit
b6bf468
·
1 Parent(s): 44459a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -56
app.py CHANGED
@@ -122,73 +122,71 @@ def main(args):
122
  )
123
 
124
 
125
- def make_frontend(fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  """Creates a gradio.Interface frontend for text to image search function."""
127
 
128
- input_section = gr.inputs.Textbox(lines=2, placeholder="Enter item description here")
129
- output_section = gr.Gallery(label="Relevant Items", show_labels=True, label_position="below")
130
-
131
- # Define Interface layout with Gradio's Row and Column
132
- interface_layout = gr.ui.Row(
133
- gr.ui.Column(
134
- gr.ui.Textbox("Fashion Aggregator", label="Title"),
135
- gr.ui.Image(LOGO, label="Logo"),
136
- gr.ui.Textbox("Discover your perfect apparel effortlessly. Simply describe what you're looking for!", label="Description"),
137
- ),
138
- gr.ui.Column(
139
- gr.ui.Section(
140
- gr.ui.Center(
141
- input_section,
142
- ),
143
- gr.ui.Center(
144
- output_section,
145
- ),
146
- )
147
- ),
148
- gr.ui.Column(
149
- gr.ui.Textbox("Disclaimer: The search results are based on embeddings and may not be always accurate.", label="Disclaimer"),
150
- ),
151
- )
152
 
153
  # Build a customized browser interface to a Python function
154
  frontend = gr.Interface(
155
  fn=fn,
156
- inputs=input_section,
157
- outputs=output_section,
158
- layout=interface_layout,
159
- allow_flagging=False,
160
- title=app_name,
161
  thumbnail=LOGO,
162
- description="Enter the description of the item you're looking for and see the corresponding images!",
 
 
 
163
  )
164
 
165
  return frontend
166
 
167
-
168
-
169
-
170
- # def make_frontend(
171
- # fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
172
- # ):
173
- # """Creates a gradio.Interface frontend for text to image search function."""
174
-
175
- # allow_flagging = "never"
176
-
177
- # # Build a customized browser interface to a Python function
178
- # frontend = gr.Interface(
179
- # fn=fn,
180
- # outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
181
- # inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
182
- # title="Fashion Aggregator",
183
- # thumbnail=LOGO,
184
- # description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
185
- # cache_examples=False,
186
- # allow_flagging=allow_flagging,
187
- # flagging_options=["incorrect", "offensive", "other"],
188
- # )
189
-
190
- # return frontend
191
-
192
 
193
  class PredictorBackend:
194
  """Interface to a backend that serves predictions.
 
122
  )
123
 
124
 
125
+ # def make_frontend(fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"):
126
+ # """Creates a gradio.Interface frontend for text to image search function."""
127
+
128
+ # output_section = gr.Gallery(label="Relevant Items", show_labels=True, label_position="below").style(columns=4, container=True))
129
+ # title = """<h1 align="center">Fashion Aggregator</h1><img src="temp.jpg" alt="Logo" width="150" align="center"/>"""
130
+ # description = """
131
+ # <div align="center">
132
+ # <h3>
133
+ # Discover your perfect apparel effortlessly. Simply describe what you're looking for!
134
+ # </h3>
135
+ # </div>
136
+ # """
137
+
138
+ # disclaimer = disclaimer = """
139
+ # <div align="center">
140
+ # <p style="font-size: small; color: gray;">
141
+ # Disclaimer: The search results are based on embeddings and may not be always accurate.
142
+ # </p>
143
+ # </div>
144
+ # """
145
+
146
+
147
+ # with gr.Blocks(css="""#col_container {width: 800px; margin-left: auto; margin-right: auto;}""") as frontend:
148
+
149
+ # gr.HTML(title)
150
+ # with gr.Column():
151
+ # gr.HTML(description)
152
+
153
+ # with gr.Column():
154
+ # inputs = gr.Textbox(label="Item Description", placeholder="Enter item description here")
155
+
156
+ # with gr.Column():
157
+ # outputs = gr.Gallery(label="Relevant Items", show_labels=True, label_position="below")
158
+
159
+
160
+
161
+
162
+
163
+ # return frontend
164
+
165
+
166
+
167
+
168
+ def make_frontend(
169
+ fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
170
+ ):
171
  """Creates a gradio.Interface frontend for text to image search function."""
172
 
173
+ allow_flagging = "never"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  # Build a customized browser interface to a Python function
176
  frontend = gr.Interface(
177
  fn=fn,
178
+ outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
179
+ inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
180
+ title="Fashion Aggregator",
 
 
181
  thumbnail=LOGO,
182
+ description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
183
+ cache_examples=False,
184
+ allow_flagging=allow_flagging,
185
+ flagging_options=["incorrect", "offensive", "other"],
186
  )
187
 
188
  return frontend
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
  class PredictorBackend:
192
  """Interface to a backend that serves predictions.