Tuchuanhuhuhu commited on
Commit
8783eb5
1 Parent(s): a13de87

去掉更新文档参数按钮

Browse files
Files changed (2) hide show
  1. ChuanhuChatbot.py +1 -2
  2. modules/config.py +3 -4
ChuanhuChatbot.py CHANGED
@@ -98,7 +98,6 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
98
  two_column = gr.Checkbox(label="双栏pdf", value=advance_docs["pdf"].get("two_column", False))
99
  # TODO: 公式ocr
100
  # formula_ocr = gr.Checkbox(label="识别公式", value=advance_docs["pdf"].get("formula_ocr", False))
101
- updateDocConfigBtn = gr.Button("更新解析文件参数")
102
 
103
  with gr.Tab(label="Prompt"):
104
  systemPromptTxt = gr.Textbox(
@@ -314,7 +313,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
314
  )
315
  reduceTokenBtn.click(**get_usage_args)
316
 
317
- updateDocConfigBtn.click(update_doc_config, [two_column], None)
318
 
319
  # ChatGPT
320
  keyTxt.change(submit_key, keyTxt, [user_api_key, status_display]).then(**get_usage_args)
 
98
  two_column = gr.Checkbox(label="双栏pdf", value=advance_docs["pdf"].get("two_column", False))
99
  # TODO: 公式ocr
100
  # formula_ocr = gr.Checkbox(label="识别公式", value=advance_docs["pdf"].get("formula_ocr", False))
 
101
 
102
  with gr.Tab(label="Prompt"):
103
  systemPromptTxt = gr.Textbox(
 
313
  )
314
  reduceTokenBtn.click(**get_usage_args)
315
 
316
+ two_column.change(update_doc_config, [two_column], None)
317
 
318
  # ChatGPT
319
  keyTxt.change(submit_key, keyTxt, [user_api_key, status_display]).then(**get_usage_args)
modules/config.py CHANGED
@@ -127,7 +127,7 @@ def retrieve_proxy(proxy=None):
127
  os.environ["HTTP_PROXY"] = http_proxy
128
  os.environ["HTTPS_PROXY"] = https_proxy
129
  yield http_proxy, https_proxy # return new proxy
130
-
131
  # return old proxy
132
  os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"] = old_var
133
 
@@ -137,7 +137,6 @@ advance_docs = defaultdict(lambda: defaultdict(dict))
137
  advance_docs.update(config.get("advance_docs", {}))
138
  def update_doc_config(two_column_pdf):
139
  global advance_docs
140
- if two_column_pdf:
141
- advance_docs["pdf"]["two_column"] = True
142
-
143
  logging.info(f"更新后的文件参数为:{advance_docs}")
 
127
  os.environ["HTTP_PROXY"] = http_proxy
128
  os.environ["HTTPS_PROXY"] = https_proxy
129
  yield http_proxy, https_proxy # return new proxy
130
+
131
  # return old proxy
132
  os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"] = old_var
133
 
 
137
  advance_docs.update(config.get("advance_docs", {}))
138
  def update_doc_config(two_column_pdf):
139
  global advance_docs
140
+ advance_docs["pdf"]["two_column"] = two_column_pdf
141
+
 
142
  logging.info(f"更新后的文件参数为:{advance_docs}")