epochs-demos commited on
Commit
afe8a75
·
1 Parent(s): cdff949

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -4
app.py CHANGED
@@ -127,22 +127,72 @@ def make_frontend(
127
  """Creates a gradio.Interface frontend for text to image search function."""
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=FAVICON,
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.
 
127
  """Creates a gradio.Interface frontend for text to image search function."""
128
 
129
  allow_flagging = "never"
130
+
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="Fashion Aggregator",
139
  thumbnail=FAVICON,
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>
150
+ <head>
151
+ <style>
152
+ /* Modify the styles according to your preferences */
153
+ .gradio-interface-container {
154
+ text-align: center;
155
+ }
156
+ .gradio-input-container {
157
+ margin-bottom: 20px;
158
+ }
159
+ .gradio-output-container {
160
+ margin-top: 20px;
161
+ }
162
+ .disclaimer {
163
+ font-size: 12px;
164
+ color: #777777;
165
+ margin-top: 20px;
166
+ text-align: center;
167
+ }
168
+ </style>
169
+ </head>
170
+ <body>
171
+ {{interface_html}}
172
+ <div class="disclaimer">
173
+ This web app is for demonstration purposes only and not intended for commercial use.
174
+ </div>
175
+ </body>
176
+ </html>
177
+ """
178
+
179
  return frontend
180
 
181
+ # # Build a customized browser interface to a Python function
182
+ # frontend = gr.Interface(
183
+ # fn=fn,
184
+ # outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
185
+ # inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
186
+ # title="Fashion Aggregator",
187
+ # thumbnail=FAVICON,
188
+ # description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!",
189
+ # cache_examples=False,
190
+ # allow_flagging=allow_flagging,
191
+ # flagging_options=["incorrect", "offensive", "other"],
192
+ # )
193
+
194
+ # return frontend
195
+
196
 
197
  class PredictorBackend:
198
  """Interface to a backend that serves predictions.