epochs-demos commited on
Commit
bb5a080
·
1 Parent(s): 09ee83b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -49
app.py CHANGED
@@ -121,47 +121,10 @@ def main(args):
121
  # favicon_path=LOGO, # what icon should we display in the address bar?
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
 
@@ -171,24 +134,37 @@ def make_frontend(
171
  """Creates a gradio.Interface frontend for text to image search function."""
172
 
173
  allow_flagging = "never"
 
 
 
 
 
 
 
 
174
  description = """
175
- <div align="center">
176
- <h3>
177
- Discover your perfect apparel effortlessly. Simply describe what you're looking for!
178
- </h3>
179
- </div>
180
  """
181
 
182
- description = f"{description}"
 
 
 
 
 
 
 
183
 
184
  frontend = gr.Interface(
185
  fn=fn,
186
  outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
187
  inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
188
- title="Fashion Aggregator",
189
  thumbnail=LOGO,
190
  description=description,
191
- article = "Disclaimer: The search results are based on embeddings and may not be always accurate.",
192
  cache_examples=False,
193
  allow_flagging=allow_flagging,
194
  flagging_options=["incorrect", "offensive", "other"],
 
121
  # favicon_path=LOGO, # what icon should we display in the address bar?
122
  )
123
 
124
+ # Read the image file and encode it as base64
125
+ with open("./1001epochs.png", "rb") as f:
126
+ image_data = f.read()
127
+ image_base64 = base64.b64encode(image_data).decode("utf-8")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
 
130
 
 
134
  """Creates a gradio.Interface frontend for text to image search function."""
135
 
136
  allow_flagging = "never"
137
+
138
+ title = """
139
+ <h1 style="background-image: linear-gradient(to right, #ADD8E6, #87CEFA); -webkit-background-clip: text;
140
+ -webkit-text-fill-color: transparent; text-align: center;">
141
+ Fashion Aggregator
142
+ </h1>
143
+ """
144
+
145
  description = """
146
+ <div style="text-align: center; font-size: 18px; color: blue;">
147
+ Discover your perfect apparel effortlessly. Simply describe what you're looking for!
148
+ </div>
 
 
149
  """
150
 
151
+ disclaimer = f"""
152
+ <div style="display: flex; align-items: center; justify-content: center;">
153
+ <img src='data:image/jpeg;base64,{image_base64}' width='50' height='50' style="margin-right: 10px;"/>
154
+ <p style="font-size: small; color: gray;">
155
+ This web app is for demonstration purposes only and not intended for commercial use. Contact: contact@1001epochs.co.uk for full solution.
156
+ </p>
157
+ </div>
158
+ """
159
 
160
  frontend = gr.Interface(
161
  fn=fn,
162
  outputs=gr.Gallery(label="Relevant Items", show_labels=True, label_position="below"),
163
  inputs=gr.inputs.Textbox(label="Item Description", placeholder="Enter item description here"),
164
+ title=title,
165
  thumbnail=LOGO,
166
  description=description,
167
+ article = disclaimer,
168
  cache_examples=False,
169
  allow_flagging=allow_flagging,
170
  flagging_options=["incorrect", "offensive", "other"],