epochs-demos commited on
Commit
f44449f
·
1 Parent(s): 75d772f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -26
app.py CHANGED
@@ -119,31 +119,27 @@ def main(args):
119
  # share=False, # should we create a (temporary) public link on https://gradio.app?
120
  # favicon_path=FAVICON, # what icon should we display in the address bar?
121
  )
122
-
123
-
124
  def make_frontend(
125
  fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
126
  ):
127
  """Creates a gradio.Interface frontend for text to image search function."""
128
 
129
  allow_flagging = "never"
130
- print(LOGO)
131
- textbox = gr.inputs.Textbox(label="Item Description")
132
 
133
  # Build a customized browser interface to a Python function
134
  frontend = gr.Interface(
135
  fn=fn,
136
- outputs=gr.outputs.HTML(""),
137
- inputs=textbox,
138
- title="<span class='title-text'>Fashion Aggregator</span><img src='{LOGO}' class='logo-image'>",
139
  thumbnail=LOGO,
140
  description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
141
- cache_in_memory=False,
142
  allow_flagging=allow_flagging,
143
  flagging_options=["incorrect", "offensive", "other"],
144
  )
145
 
146
- # Customize the HTML template to include the disclaimer
147
  frontend.template = """
148
  <!DOCTYPE html>
149
  <html>
@@ -165,12 +161,17 @@ def make_frontend(
165
  margin-top: 20px;
166
  text-align: center;
167
  }
 
 
 
 
 
 
 
 
168
  </style>
169
  </head>
170
  <body>
171
- <div class="disclaimer">
172
- This web app is for demonstration purposes only and not intended for commercial use.
173
- </div>
174
  {{interface_html}}
175
  <div class="disclaimer">
176
  This web app is for demonstration purposes only and not intended for commercial use.
@@ -181,20 +182,27 @@ def make_frontend(
181
 
182
  return frontend
183
 
184
- # # Build a customized browser interface to a Python function
185
- # frontend = gr.Interface(
186
- # fn=fn,
187
- # outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
188
- # inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
189
- # title="Fashion Aggregator",
190
- # thumbnail=FAVICON,
191
- # description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
192
- # cache_examples=False,
193
- # allow_flagging=allow_flagging,
194
- # flagging_options=["incorrect", "offensive", "other"],
195
- # )
196
-
197
- # return frontend
 
 
 
 
 
 
 
198
 
199
 
200
  class PredictorBackend:
 
119
  # share=False, # should we create a (temporary) public link on https://gradio.app?
120
  # favicon_path=FAVICON, # what icon should we display in the address bar?
121
  )
 
 
122
  def make_frontend(
123
  fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
124
  ):
125
  """Creates a gradio.Interface frontend for text to image search function."""
126
 
127
  allow_flagging = "never"
 
 
128
 
129
  # Build a customized browser interface to a Python function
130
  frontend = gr.Interface(
131
  fn=fn,
132
+ outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
133
+ inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
134
+ title="<span class='title-text'>Fashion Aggregator</span><img src='{logo}' class='logo-image'>".format(logo=LOGO),
135
  thumbnail=LOGO,
136
  description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
137
+ cache_examples=False,
138
  allow_flagging=allow_flagging,
139
  flagging_options=["incorrect", "offensive", "other"],
140
  )
141
 
142
+ # Customize the HTML template to include the disclaimer and style the title
143
  frontend.template = """
144
  <!DOCTYPE html>
145
  <html>
 
161
  margin-top: 20px;
162
  text-align: center;
163
  }
164
+ .title-text {
165
+ display: inline-block;
166
+ }
167
+ .logo-image {
168
+ display: inline-block;
169
+ vertical-align: middle;
170
+ margin-left: 10px;
171
+ }
172
  </style>
173
  </head>
174
  <body>
 
 
 
175
  {{interface_html}}
176
  <div class="disclaimer">
177
  This web app is for demonstration purposes only and not intended for commercial use.
 
182
 
183
  return frontend
184
 
185
+ # def make_frontend(
186
+ # fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
187
+ # ):
188
+ # """Creates a gradio.Interface frontend for text to image search function."""
189
+
190
+ # allow_flagging = "never"
191
+
192
+ # # Build a customized browser interface to a Python function
193
+ # frontend = gr.Interface(
194
+ # fn=fn,
195
+ # outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
196
+ # inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
197
+ # title="Fashion Aggregator",
198
+ # thumbnail=FAVICON,
199
+ # description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
200
+ # cache_examples=False,
201
+ # allow_flagging=allow_flagging,
202
+ # flagging_options=["incorrect", "offensive", "other"],
203
+ # )
204
+
205
+ # return frontend
206
 
207
 
208
  class PredictorBackend: