-
Notifications
You must be signed in to change notification settings - Fork 0
/
streamlit_app.py
54 lines (39 loc) · 1.55 KB
/
streamlit_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import streamlit as st
import requests
import pandas as pd
def main():
st.set_page_config(
layout="wide",
initial_sidebar_state="auto",
page_title="Improved Musinsa FAQ.",
page_icon=None,
)
st.title("Improved Musinsa FAQ")
ex_names = [
""" 이사를 가게되면 배송지는 어떻게 하나요? """,
""" 제가 산 상품이 모조품인것 같아요. """
]
example = st.selectbox("무신사 FAQ에 궁금한 내용을 여기에서 클릭할 수 있어요.", ex_names)
user_input = st.text_area(
"무신사 FAQ에 묻고 싶은 내용을 적어보세요!", example[0], max_chars=2000, height=150,
)
try:
rec = ex_names.index(user_input)
except ValueError:
rec = 0
response = None
with st.form(key="inputs"):
submit_button = st.form_submit_button(label="질문해보기!")
if submit_button:
payload = {
"requested_sentence": user_input,
}
headers = {'Content-Type': 'application/json; charset=utf-8'}
resp = requests.get("http://localhost:9999/search_knn/async_vector_search", params=payload, headers=headers)
responsed_sentences = dict(resp.json())["query_result"]
rst_df = pd.DataFrame.from_dict(responsed_sentences)
st.write("FAQ Query Result.")
st.table(rst_df)
st.text("from junwoo.kim")
if __name__ == "__main__":
main()