mpsk commited on
Commit
3893f84
β€’
1 Parent(s): 84a2ae9

refined layout

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -1,10 +1,7 @@
1
- import enum
2
- from turtle import onclick
3
  import streamlit as st
4
  import numpy as np
5
  import base64
6
  from io import BytesIO
7
- import requests
8
  from multilingual_clip import pt_multilingual_clip
9
  from transformers import CLIPTokenizerFast, AutoTokenizer
10
  import torch
@@ -40,8 +37,6 @@ def init_db():
40
  client: Database connection object
41
  """
42
  client = Client(url=st.secrets["DB_URL"], user=st.secrets["USER"], password=st.secrets["PASSWD"])
43
- resp = requests.get('https://www.google.com/')
44
- assert resp.status_code == 200
45
  # We can check if the connection is alive
46
  assert client.is_alive()
47
  meta_field = {}
@@ -186,7 +181,7 @@ def card(i, url):
186
 
187
  def card_with_conf(i, conf, url):
188
  conf = "%.4f"%(conf)
189
- return f'<img id="img{i}" src="{url}" width="200px;" style="margin:50px 50px"><b>Relevance: {conf}</b>'
190
 
191
  def get_top_k(xq, top_k=9):
192
  """ wrapper function for query
@@ -322,7 +317,8 @@ if 'xq' not in st.session_state:
322
  start[0].info(msg)
323
  prompt = start[1].text_input("Prompt:", value="", placeholder="Examples: a photo of white dogs, cats in the snow, a house by the lake")
324
  start[2].markdown(
325
- '<p style="color:gray;"> Don\'t know what to search? Try <b>Random</b>!</p>',
 
326
  unsafe_allow_html=True)
327
  with start[3]:
328
  col = st.columns(8)
 
 
 
1
  import streamlit as st
2
  import numpy as np
3
  import base64
4
  from io import BytesIO
 
5
  from multilingual_clip import pt_multilingual_clip
6
  from transformers import CLIPTokenizerFast, AutoTokenizer
7
  import torch
 
37
  client: Database connection object
38
  """
39
  client = Client(url=st.secrets["DB_URL"], user=st.secrets["USER"], password=st.secrets["PASSWD"])
 
 
40
  # We can check if the connection is alive
41
  assert client.is_alive()
42
  meta_field = {}
 
181
 
182
  def card_with_conf(i, conf, url):
183
  conf = "%.4f"%(conf)
184
+ return f'<img id="img{i}" src="{url}" width="200px;" style="margin:50px 50px"><div><p><b>Relevance: {conf}</b></p></div>'
185
 
186
  def get_top_k(xq, top_k=9):
187
  """ wrapper function for query
 
317
  start[0].info(msg)
318
  prompt = start[1].text_input("Prompt:", value="", placeholder="Examples: a photo of white dogs, cats in the snow, a house by the lake")
319
  start[2].markdown(
320
+ '<p style="color:gray;"> Don\'t know what to search? Try <b>Random</b>!</p>\
321
+ <p>🌟 We also supported multi-language search. Type any language you know to search!⌨️ </p>',
322
  unsafe_allow_html=True)
323
  with start[3]:
324
  col = st.columns(8)