Spaces:
Runtime error
Runtime error
Commit
ยท
7951d45
1
Parent(s):
33e9776
edit chatbot ment
Browse files
app.py
CHANGED
|
@@ -271,6 +271,7 @@ def get_similar_means(vocab):
|
|
| 271 |
|
| 272 |
return mean_list_str_final
|
| 273 |
|
|
|
|
| 274 |
#info_dict = {}
|
| 275 |
def run_all(message, history):
|
| 276 |
global info_dict
|
|
@@ -282,8 +283,8 @@ def run_all(message, history):
|
|
| 282 |
info_dict[nickname] = {}
|
| 283 |
return f'''์ข์์! ์์ํ ๊ฒ์ {nickname}๋.
|
| 284 |
์ง๊ธ ๋จธ๋ฆฟ์์ ๋ ์ค๋ฅด๋ ๋จ์ด๋ฅผ ํ๋ ์
๋ ฅํด์ฃผ์ธ์.
|
| 285 |
-
๋จ์ด๋ฅผ ์
๋ ฅํ ๋ \"๋จ์ด: \" ๋ฅผ ํฌํจํด์ฃผ์ธ์
|
| 286 |
-
|
| 287 |
'''
|
| 288 |
try :
|
| 289 |
#print(nickname)
|
|
@@ -304,14 +305,12 @@ def run_all(message, history):
|
|
| 304 |
sentence_str = ' \n'.join([str(idx) + ") " + i for idx, i in enumerate(fixed_similar_words_final, 1)])
|
| 305 |
return f'''<{clear_message}> ์ ํ์ฉํ ๊ธ์ฐ๊ธฐ๋ฅผ ์์ํด๋ณผ๊น์?
|
| 306 |
์ฐ์ , ์ ์ฌํ ๋จ์ด๋ถํฐ ํ์ธํด๋ณผ๊ฒ์.
|
| 307 |
-
{word_str}
|
| 308 |
-
\n
|
| 309 |
์ ์ฌํ ๋จ์ด๋ค์ ๋ป์ ์๋์ ๊ฐ์ต๋๋ค.
|
| 310 |
-
{sentence_str}
|
| 311 |
-
|
| 312 |
-
\n
|
| 313 |
-
|
| 314 |
-
์ํ๋ ๋ฌธ์ฅ์ ๊ณจ๋ผ์ "๋ฌธ์ฅ:" ์ ํฌํจํด ์
๋ ฅํด์ฃผ์ธ์.
|
| 315 |
'''
|
| 316 |
else:
|
| 317 |
return '\"๋จ์ด:\" ๋ฅผ ํฌํจํด์ ๋จ์ด๋ฅผ ์
๋ ฅํด์ฃผ์ธ์ (๋จ์ด: ์ปคํผ)'
|
|
@@ -319,12 +318,10 @@ def run_all(message, history):
|
|
| 319 |
elif message.find('๋ฌธ์ฅ:')>=0:
|
| 320 |
clear_message = message.replace('๋ฌธ์ฅ','').replace(':','').strip()
|
| 321 |
info_dict[nickname]['selected_sentence'] = clear_message
|
| 322 |
-
return f'''
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
\"์งง์๊ธ: \"์ ํฌํจํด ์
๋ ฅํด์ฃผ์ธ์
|
| 327 |
-
(์งง์๊ธ: ์ง๊ธ ๋ฐฅ์ ๋จน๊ณ ์๋ ์ค์ด๋ค)
|
| 328 |
|
| 329 |
'''
|
| 330 |
|
|
@@ -334,9 +331,8 @@ def run_all(message, history):
|
|
| 334 |
|
| 335 |
return f'''<{clear_message}>๋ผ๊ณ ์
๋ ฅํด์ฃผ์
จ๋ค์.
|
| 336 |
\n ์ ๋ฌธ์ฅ์ ํ์ฉํด ๊ธด ๊ธ์ฐ๊ธฐ๋ฅผ ํด๋ณผ๊น์? 500์ ์ด์ ์์ฑํด์ฃผ์๋ฉด ์ข์์.
|
| 337 |
-
\n
|
| 338 |
-
\n
|
| 339 |
-
|
| 340 |
'''
|
| 341 |
elif message.find('๊ธด๊ธ:')>=0:
|
| 342 |
long_message = message.replace('๊ธด๊ธ','').replace(':','').strip()
|
|
@@ -354,8 +350,10 @@ def run_all(message, history):
|
|
| 354 |
elif message.find('๋ถ์์์')>=0:
|
| 355 |
with open(f"./result/{nickname}/contents.txt",'r') as f:
|
| 356 |
orign_essay = f.read()
|
| 357 |
-
|
| 358 |
-
|
|
|
|
|
|
|
| 359 |
else:
|
| 360 |
return '์ฒ์๋ถํฐ ์์ํด์ฃผ์ธ์'
|
| 361 |
|
|
|
|
| 271 |
|
| 272 |
return mean_list_str_final
|
| 273 |
|
| 274 |
+
info_dict = {}
|
| 275 |
#info_dict = {}
|
| 276 |
def run_all(message, history):
|
| 277 |
global info_dict
|
|
|
|
| 283 |
info_dict[nickname] = {}
|
| 284 |
return f'''์ข์์! ์์ํ ๊ฒ์ {nickname}๋.
|
| 285 |
์ง๊ธ ๋จธ๋ฆฟ์์ ๋ ์ค๋ฅด๋ ๋จ์ด๋ฅผ ํ๋ ์
๋ ฅํด์ฃผ์ธ์.
|
| 286 |
+
\n\n\n๋จ์ด๋ฅผ ์
๋ ฅํ ๋ \"๋จ์ด: \" ๋ฅผ ํฌํจํด์ฃผ์ธ์
|
| 287 |
+
์์ <๋จ์ด: ์ปคํผ>
|
| 288 |
'''
|
| 289 |
try :
|
| 290 |
#print(nickname)
|
|
|
|
| 305 |
sentence_str = ' \n'.join([str(idx) + ") " + i for idx, i in enumerate(fixed_similar_words_final, 1)])
|
| 306 |
return f'''<{clear_message}> ์ ํ์ฉํ ๊ธ์ฐ๊ธฐ๋ฅผ ์์ํด๋ณผ๊น์?
|
| 307 |
์ฐ์ , ์ ์ฌํ ๋จ์ด๋ถํฐ ํ์ธํด๋ณผ๊ฒ์.
|
| 308 |
+
{word_str} \n
|
|
|
|
| 309 |
์ ์ฌํ ๋จ์ด๋ค์ ๋ป์ ์๋์ ๊ฐ์ต๋๋ค.
|
| 310 |
+
{sentence_str}\n
|
| 311 |
+
์ ๋ป ์ค์ ์ํ๋ ๋ป์ ๊ณจ๋ผ ์
๋ ฅํด์ฃผ์ธ์
|
| 312 |
+
\n\n\n ์
๋ ฅ์์ \"๋ฌธ์ฅ:\" ์ ํฌํจํด์ฃผ์ธ์. ์์๋ ๋ณด์ฌ๋๋ฆด๊ฒ์.
|
| 313 |
+
\n ์์ <๋ฌธ์ฅ: ์ผ์ ํ ์ฃผ์ ๋ ์ค๊ฑฐ๋ฆฌ๋ฅผ ๊ฐ์ง ์ด์ผ๊ธฐ>
|
|
|
|
| 314 |
'''
|
| 315 |
else:
|
| 316 |
return '\"๋จ์ด:\" ๋ฅผ ํฌํจํด์ ๋จ์ด๋ฅผ ์
๋ ฅํด์ฃผ์ธ์ (๋จ์ด: ์ปคํผ)'
|
|
|
|
| 318 |
elif message.find('๋ฌธ์ฅ:')>=0:
|
| 319 |
clear_message = message.replace('๋ฌธ์ฅ','').replace(':','').strip()
|
| 320 |
info_dict[nickname]['selected_sentence'] = clear_message
|
| 321 |
+
return f'''[{clear_message}]๋ฅผ ๊ณ ๋ฅด์
จ๋ค์.
|
| 322 |
+
\n ์ ๋ฌธ์ฅ์ ํ์ฉํด ์งง์ ๊ธ์ฐ๊ธฐ๋ฅผ ํด๋ณผ๊น์?
|
| 323 |
+
\n\n\n ์
๋ ฅ์์\"์งง์๊ธ: \"์ ํฌํจํด์ฃผ์ธ์. ์์๋ ๋ณด์ฌ๋๋ฆด๊ฒ์.
|
| 324 |
+
\n ์์ <์งง์๊ธ: ์ง๊ธ ๋ฐฅ์ ๋จน๊ณ ์๋ ์ค์ด๋ค>
|
|
|
|
|
|
|
| 325 |
|
| 326 |
'''
|
| 327 |
|
|
|
|
| 331 |
|
| 332 |
return f'''<{clear_message}>๋ผ๊ณ ์
๋ ฅํด์ฃผ์
จ๋ค์.
|
| 333 |
\n ์ ๋ฌธ์ฅ์ ํ์ฉํด ๊ธด ๊ธ์ฐ๊ธฐ๋ฅผ ํด๋ณผ๊น์? 500์ ์ด์ ์์ฑํด์ฃผ์๋ฉด ์ข์์.
|
| 334 |
+
\n\n\n ์
๋ ฅ์์\"๊ธด๊ธ: \"์ ํฌํจํด์ฃผ์ธ์. ์์๋ ๋ณด์ฌ๋๋ฆด๊ฒ์.
|
| 335 |
+
\n ์์ <๊ธด๊ธ: ์ง๊ธ ๋ฐฅ์ ๋จน๊ณ ์๋ ์ค์ด๋ค. ๋ฐฅ์ ๋จน์๋ ๋ง๋ค ๋๋ ๋ฐฅ์์ ํ๋ฐ๋ฅ์ผ๋ก ๊ตด๋ ค๋ณธ๋ค. ... (์๋ต) >
|
|
|
|
| 336 |
'''
|
| 337 |
elif message.find('๊ธด๊ธ:')>=0:
|
| 338 |
long_message = message.replace('๊ธด๊ธ','').replace(':','').strip()
|
|
|
|
| 350 |
elif message.find('๋ถ์์์')>=0:
|
| 351 |
with open(f"./result/{nickname}/contents.txt",'r') as f:
|
| 352 |
orign_essay = f.read()
|
| 353 |
+
summary = all_process(orign_essay, nickname)
|
| 354 |
+
|
| 355 |
+
#print(summary)
|
| 356 |
+
return summary
|
| 357 |
else:
|
| 358 |
return '์ฒ์๋ถํฐ ์์ํด์ฃผ์ธ์'
|
| 359 |
|