Spaces:
Sleeping
Sleeping
Update crazy_functions/批量总结PDF文档.py
Browse files
crazy_functions/批量总结PDF文档.py
CHANGED
|
@@ -3,7 +3,7 @@ from toolbox import CatchException, report_execption, write_results_to_file, pre
|
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
|
| 6 |
-
def 解析PDF(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt):
|
| 7 |
import time, glob, os, fitz
|
| 8 |
print('begin analysis on:', file_manifest)
|
| 9 |
for index, fp in enumerate(file_manifest):
|
|
@@ -23,7 +23,7 @@ def 解析PDF(file_manifest, project_folder, top_p, temperature, chatbot, histor
|
|
| 23 |
if not fast_debug:
|
| 24 |
msg = '正常'
|
| 25 |
# ** gpt request **
|
| 26 |
-
gpt_say = yield from predict_no_ui_but_counting_down(i_say, i_say_show_user, chatbot, top_p, temperature, history=[]) # 带超时倒计时
|
| 27 |
|
| 28 |
print('[2] end gpt req')
|
| 29 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
|
@@ -41,7 +41,7 @@ def 解析PDF(file_manifest, project_folder, top_p, temperature, chatbot, histor
|
|
| 41 |
if not fast_debug:
|
| 42 |
msg = '正常'
|
| 43 |
# ** gpt request **
|
| 44 |
-
gpt_say = yield from predict_no_ui_but_counting_down(i_say, i_say, chatbot, top_p, temperature, history=history) # 带超时倒计时
|
| 45 |
|
| 46 |
chatbot[-1] = (i_say, gpt_say)
|
| 47 |
history.append(i_say); history.append(gpt_say)
|
|
@@ -52,7 +52,7 @@ def 解析PDF(file_manifest, project_folder, top_p, temperature, chatbot, histor
|
|
| 52 |
|
| 53 |
|
| 54 |
@CatchException
|
| 55 |
-
def 批量总结PDF文档(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
|
| 56 |
import glob, os
|
| 57 |
|
| 58 |
# 基本信息:功能、贡献者
|
|
@@ -96,4 +96,4 @@ def 批量总结PDF文档(txt, top_p, temperature, chatbot, history, systemPromp
|
|
| 96 |
return
|
| 97 |
|
| 98 |
# 开始正式执行任务
|
| 99 |
-
yield from 解析PDF(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
|
|
|
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
|
| 6 |
+
def 解析PDF(api, file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt):
|
| 7 |
import time, glob, os, fitz
|
| 8 |
print('begin analysis on:', file_manifest)
|
| 9 |
for index, fp in enumerate(file_manifest):
|
|
|
|
| 23 |
if not fast_debug:
|
| 24 |
msg = '正常'
|
| 25 |
# ** gpt request **
|
| 26 |
+
gpt_say = yield from predict_no_ui_but_counting_down(api, i_say, i_say_show_user, chatbot, top_p, temperature, history=[]) # 带超时倒计时
|
| 27 |
|
| 28 |
print('[2] end gpt req')
|
| 29 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
|
|
|
| 41 |
if not fast_debug:
|
| 42 |
msg = '正常'
|
| 43 |
# ** gpt request **
|
| 44 |
+
gpt_say = yield from predict_no_ui_but_counting_down(api, i_say, i_say, chatbot, top_p, temperature, history=history) # 带超时倒计时
|
| 45 |
|
| 46 |
chatbot[-1] = (i_say, gpt_say)
|
| 47 |
history.append(i_say); history.append(gpt_say)
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
@CatchException
|
| 55 |
+
def 批量总结PDF文档(api, txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
|
| 56 |
import glob, os
|
| 57 |
|
| 58 |
# 基本信息:功能、贡献者
|
|
|
|
| 96 |
return
|
| 97 |
|
| 98 |
# 开始正式执行任务
|
| 99 |
+
yield from 解析PDF(api, file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt)
|