Ridealist commited on
Commit
92005d0
ยท
1 Parent(s): 94d0958

Update chatgpt_app.py

Browse files
Files changed (1) hide show
  1. chatgpt_app.py +19 -18
chatgpt_app.py CHANGED
@@ -58,24 +58,25 @@ with col1:
58
 
59
  if submitted and user_input:
60
 
61
- ## Sentence-BERT ๊ธฐ๋ฐ˜
62
- question_vectors = model.encode(q_fin)
63
- target_vector = model.encode(user_input)
64
- similarities_sbert = util.cos_sim(question_vectors, target_vector) # compute similarity between sentence vectors
65
-
66
- ## Sequence Matcher ๊ธฐ๋ฐ˜
67
- # similarities_seqmat = []
68
- # user_sent_bytes = bytes(user_input, 'utf-8')
69
- # user_sent_bytes_list = list(user_sent_bytes)
70
-
71
- # for sent in q_fin:
72
- # sent_bytes = bytes(sent, 'utf-8')
73
- # sent_bytes_list = list(sent_bytes)
74
- # score = difflib.SequenceMatcher(None, user_sent_bytes_list, sent_bytes_list).ratio()
75
- # similarities_seqmat.append(score)
76
-
77
- # similarities_seqmat = np.array(similarities_seqmat)
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: