Spaces:
Sleeping
Sleeping
Update chatgpt_app.py
Browse files- chatgpt_app.py +19 -18
chatgpt_app.py
CHANGED
@@ -58,24 +58,25 @@ with col1:
|
|
58 |
|
59 |
if submitted and user_input:
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
79 |
if similarities_sbert.max() < 0.2:
|
80 |
output = "์ ๋ชป ์์๋ฃ๊ฒ ์ด์ ์ ์๋. ๋ค์ ๋ง์ํด์ฃผ์ธ์..."
|
81 |
else:
|
|
|
58 |
|
59 |
if submitted and user_input:
|
60 |
|
61 |
+
with st.spinner('Wait for it...'):
|
62 |
+
## Sentence-BERT ๊ธฐ๋ฐ
|
63 |
+
question_vectors = model.encode(q_fin)
|
64 |
+
target_vector = model.encode(user_input)
|
65 |
+
similarities_sbert = util.cos_sim(question_vectors, target_vector) # compute similarity between sentence vectors
|
66 |
+
|
67 |
+
## Sequence Matcher ๊ธฐ๋ฐ
|
68 |
+
# similarities_seqmat = []
|
69 |
+
# user_sent_bytes = bytes(user_input, 'utf-8')
|
70 |
+
# user_sent_bytes_list = list(user_sent_bytes)
|
71 |
+
|
72 |
+
# for sent in q_fin:
|
73 |
+
# sent_bytes = bytes(sent, 'utf-8')
|
74 |
+
# sent_bytes_list = list(sent_bytes)
|
75 |
+
# score = difflib.SequenceMatcher(None, user_sent_bytes_list, sent_bytes_list).ratio()
|
76 |
+
# similarities_seqmat.append(score)
|
77 |
+
|
78 |
+
# similarities_seqmat = np.array(similarities_seqmat)
|
79 |
+
|
80 |
if similarities_sbert.max() < 0.2:
|
81 |
output = "์ ๋ชป ์์๋ฃ๊ฒ ์ด์ ์ ์๋. ๋ค์ ๋ง์ํด์ฃผ์ธ์..."
|
82 |
else:
|