Spaces:
Runtime error
Runtime error
Commit
·
b30f27a
1
Parent(s):
e6ed859
Update app.py
Browse files
app.py
CHANGED
@@ -128,21 +128,48 @@ def make_frontend(
|
|
128 |
|
129 |
allow_flagging = "never"
|
130 |
|
131 |
-
|
132 |
frontend = gr.Interface(
|
133 |
-
fn=fn,
|
134 |
outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
flagging_options=["incorrect", "offensive", "other"], # what options do users have for feedback?
|
143 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
return frontend
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
class PredictorBackend:
|
148 |
"""Interface to a backend that serves predictions.
|
|
|
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", # Title
|
137 |
+
thumbnail="./1001epochs.png", # Company logo image
|
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 |
+
# Apply custom CSS styles to enhance the design and layout
|
145 |
+
frontend.styles(
|
146 |
+
# Modify the styles according to your preferences
|
147 |
+
title="color: #333333; font-size: 28px; font-weight: bold; margin-bottom: 10px;",
|
148 |
+
description="color: #666666; font-size: 16px; margin-bottom: 20px;",
|
149 |
+
input="padding: 10px; border-radius: 5px; border: 1px solid #dddddd; font-size: 16px; width: 80%;",
|
150 |
+
output_gallery="margin-top: 20px;",
|
151 |
+
output_image="border-radius: 10px; box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);",
|
152 |
+
flag_button="background-color: #ff5555;",
|
153 |
+
flag_options="color: #333333;",
|
154 |
+
)
|
155 |
+
|
156 |
return frontend
|
157 |
|
158 |
+
# # build a basic browser interface to a Python function
|
159 |
+
# frontend = gr.Interface(
|
160 |
+
# fn=fn, # which Python function are we interacting with?
|
161 |
+
# outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
|
162 |
+
# # what input widgets does it need? we configure an image widget
|
163 |
+
# inputs=gr.components.Textbox(label="Item Description", placeholder="Enter item description here"),
|
164 |
+
# title="Fashion Aggregator", # what should we display at the top of the page?
|
165 |
+
# thumbnail="1001epochs.png", # what should we display when the link is shared, e.g. on social media?
|
166 |
+
# description="Discover your perfect apparel effortlessly. Simply describe what you're looking for!", # what should we display just above the interface?
|
167 |
+
# cache_examples=False, # should we cache those inputs for faster inference? slows down start
|
168 |
+
# allow_flagging=allow_flagging, # should we show users the option to "flag" outputs?
|
169 |
+
# flagging_options=["incorrect", "offensive", "other"], # what options do users have for feedback?
|
170 |
+
# )
|
171 |
+
# return frontend
|
172 |
+
|
173 |
|
174 |
class PredictorBackend:
|
175 |
"""Interface to a backend that serves predictions.
|