epochs-demos commited on
Commit
89598c8
·
1 Parent(s): c62a676

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -71
app.py CHANGED
@@ -121,8 +121,6 @@ def main(args):
121
  )
122
 
123
 
124
- from PIL import Image
125
-
126
  def make_frontend(
127
  fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
128
  ):
@@ -130,89 +128,22 @@ def make_frontend(
130
 
131
  allow_flagging = "never"
132
 
133
- # Resize the logo image to a smaller size
134
- resized_logo = Image.open(LOGO).resize((100, 100)) # Adjust the size as per your preference
135
-
136
  # Build a customized browser interface to a Python function
137
  frontend = gr.Interface(
138
  fn=fn,
139
  outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
140
  inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
141
- title="<span class='title-text'>Fashion Aggregator</span><img src='{logo}' class='logo-image'>".format(logo=resized_logo),
142
- thumbnail=FAVICON,
143
  description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
144
  cache_examples=False,
145
  allow_flagging=allow_flagging,
146
  flagging_options=["incorrect", "offensive", "other"],
147
  )
148
 
149
- # Customize the HTML template to include the disclaimer and style the title
150
- frontend.template = """
151
- <!DOCTYPE html>
152
- <html>
153
- <head>
154
- <style>
155
- /* Modify the styles according to your preferences */
156
- .gradio-interface-container {
157
- text-align: center;
158
- }
159
- .gradio-input-container {
160
- margin-bottom: 20px;
161
- }
162
- .gradio-output-container {
163
- margin-top: 20px;
164
- }
165
- .disclaimer {
166
- font-size: 12px;
167
- color: #777777;
168
- margin-top: 20px;
169
- text-align: center;
170
- }
171
- .title-text {
172
- display: inline-block;
173
- }
174
- .logo-image {
175
- display: inline-block;
176
- vertical-align: middle;
177
- margin-left: 10px;
178
- }
179
- </style>
180
- </head>
181
- <body>
182
- {{interface_html}}
183
- <div class="disclaimer">
184
- This web app is for demonstration purposes only and not intended for commercial use.
185
- </div>
186
- </body>
187
- </html>
188
- """
189
-
190
  return frontend
191
 
192
 
193
- # def make_frontend(
194
- # fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
195
- # ):
196
- # """Creates a gradio.Interface frontend for text to image search function."""
197
-
198
- # allow_flagging = "never"
199
-
200
- # # Build a customized browser interface to a Python function
201
- # frontend = gr.Interface(
202
- # fn=fn,
203
- # outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
204
- # inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
205
- # title="Fashion Aggregator",
206
- # thumbnail=LOGO,
207
- # description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
208
- # cache_examples=False,
209
- # allow_flagging=allow_flagging,
210
- # flagging_options=["incorrect", "offensive", "other"],
211
- # )
212
-
213
- # return frontend
214
-
215
-
216
  class PredictorBackend:
217
  """Interface to a backend that serves predictions.
218
 
 
121
  )
122
 
123
 
 
 
124
  def make_frontend(
125
  fn: Callable[[Image], str], flagging: bool = False, gantry: bool = False, app_name: str = "fashion-aggregator"
126
  ):
 
128
 
129
  allow_flagging = "never"
130
 
 
 
 
131
  # Build a customized browser interface to a Python function
132
  frontend = gr.Interface(
133
  fn=fn,
134
  outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
135
  inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
136
+ title="Fashion Aggregator",
137
+ thumbnail=LOGO,
138
  description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
139
  cache_examples=False,
140
  allow_flagging=allow_flagging,
141
  flagging_options=["incorrect", "offensive", "other"],
142
  )
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  return frontend
145
 
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  class PredictorBackend:
148
  """Interface to a backend that serves predictions.
149