chatbot-demo / search.py
muryshev's picture
init
7c28e1f
raw
history blame contribute delete
558 Bytes
import requests
def search(query, port=7860, top=15):
response = requests.post(f"https://muryshev-chatbot-demo-search.hf.space/search",
json={"query": query, 'top': top,})
if response.status_code == 200:
doc_names = response.json().get("predictions", [])
texts = response.json().get("documents", [])
else:
print(f"Error: {response.status_code}")
print(response.text)
return doc_names, texts
# query = 'Как красить бетон?'
# names, texts = search(query)
# print(texts)