Yijun-Yang commited on
Commit
558c36e
1 Parent(s): 1e283a4

addapcesgpu

Browse files
Files changed (29) hide show
  1. app.py +9 -5
  2. deepdoc/__pycache__/__init__.cpython-310.pyc +0 -0
  3. deepdoc/parser/__pycache__/__init__.cpython-310.pyc +0 -0
  4. deepdoc/parser/__pycache__/pdf_parser.cpython-310.pyc +0 -0
  5. deepdoc/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  6. deepdoc/utils/__pycache__/file_utils.cpython-310.pyc +0 -0
  7. deepdoc/utils/__pycache__/log_utils.cpython-310.pyc +0 -0
  8. deepdoc/utils/__pycache__/rag_tokenizer.cpython-310.pyc +0 -0
  9. deepdoc/vision/__pycache__/__init__.cpython-310.pyc +0 -0
  10. deepdoc/vision/__pycache__/layout_recognizer.cpython-310.pyc +0 -0
  11. deepdoc/vision/__pycache__/ocr.cpython-310.pyc +0 -0
  12. deepdoc/vision/__pycache__/operators.cpython-310.pyc +0 -0
  13. deepdoc/vision/__pycache__/postprocess.cpython-310.pyc +0 -0
  14. deepdoc/vision/__pycache__/recognizer.cpython-310.pyc +0 -0
  15. deepdoc/vision/__pycache__/table_structure_recognizer.cpython-310.pyc +0 -0
  16. huixiangdou/__pycache__/__init__.cpython-310.pyc +0 -0
  17. huixiangdou/service/__pycache__/__init__.cpython-310.pyc +0 -0
  18. huixiangdou/service/__pycache__/cluster.cpython-310.pyc +0 -0
  19. huixiangdou/service/__pycache__/config.cpython-310.pyc +0 -0
  20. huixiangdou/service/__pycache__/feature_store.cpython-310.pyc +0 -0
  21. huixiangdou/service/__pycache__/file_operation.cpython-310.pyc +0 -0
  22. huixiangdou/service/__pycache__/findarticles.cpython-310.pyc +0 -0
  23. huixiangdou/service/__pycache__/helper.cpython-310.pyc +0 -0
  24. huixiangdou/service/__pycache__/llm_client.cpython-310.pyc +0 -0
  25. huixiangdou/service/__pycache__/llm_server_hybrid.cpython-310.pyc +0 -0
  26. huixiangdou/service/__pycache__/retriever.cpython-310.pyc +0 -0
  27. huixiangdou/service/__pycache__/sg_search.cpython-310.pyc +0 -0
  28. huixiangdou/service/__pycache__/web_search.cpython-310.pyc +0 -0
  29. huixiangdou/service/__pycache__/worker.cpython-310.pyc +0 -0
app.py CHANGED
@@ -12,6 +12,7 @@ from multiprocessing import Process, Value
12
  import gradio as gr
13
  import pytoml
14
  from loguru import logger
 
15
 
16
  from huixiangdou.service import Worker, llm_serve, ArticleRetrieval, CacheRetriever, FeatureStore, FileOperation
17
 
@@ -98,7 +99,7 @@ def update_remote_config(remote_ornot,remote_company = None,api = None,model = N
98
  pytoml.dump(config, f)
99
  return gr.Button("配置已保存")
100
 
101
-
102
  def get_ready(query:str,chunksize=None,k=None):
103
 
104
  with open(CONFIG_PATH, encoding='utf8') as f:
@@ -196,6 +197,7 @@ def generate_articles_repo(keywords:str,retmax:int):
196
  retmax = retmax)
197
  articelfinder.initiallize()
198
  return update_repo()
 
199
  def delete_articles_repo():
200
  # 在这里运行生成数据库的函数
201
  repodir, workdir, _ = get_ready('repo_work')
@@ -242,7 +244,7 @@ def update_database_info():
242
 
243
  return new_options, jsonobj
244
 
245
-
246
  def generate_database(chunksize:int,nclusters:str|list[str]):
247
  # 在这里运行生成数据库的函数
248
  repodir, workdir, _ = get_ready('repo_work')
@@ -277,8 +279,8 @@ def delete_database():
277
  _, workdir, _ = get_ready('repo_work')
278
  if os.path.exists(workdir):
279
  shutil.rmtree(workdir)
280
-
281
  return gr.Textbox(label="数据库概况",lines =3,value = '数据库已删除',visible = True)
 
282
  def update_database_textbox():
283
  texts, _ = update_database_info()
284
  if texts == []:
@@ -295,6 +297,7 @@ def update_ncluster_dropdown(chunksize:int):
295
  nclusters = jsonobj[chunksize]
296
  return gr.Dropdown(choices= nclusters)
297
 
 
298
  def annotation(n,chunksize:int,nclusters:int,remote_ornot:bool):
299
  '''
300
  use llm to annotate cluster
@@ -334,7 +337,7 @@ def annotation(n,chunksize:int,nclusters:int,remote_ornot:bool):
334
 
335
  return '\n\n'.join([obj['annotation'] for obj in new_obj_list])
336
 
337
-
338
  def inspiration(annotation:str,chunksize:int,nclusters:int,remote_ornot:bool):
339
  query = 'inspiration'
340
  if remote_ornot:
@@ -382,7 +385,8 @@ def getpmcurls(references):
382
  else:
383
  urls.append(ref)
384
  return urls
385
-
 
386
  def summarize_text(query,chunksize:int,remote_ornot:bool):
387
  if remote_ornot:
388
  backend = 'remote'
 
12
  import gradio as gr
13
  import pytoml
14
  from loguru import logger
15
+ import spaces
16
 
17
  from huixiangdou.service import Worker, llm_serve, ArticleRetrieval, CacheRetriever, FeatureStore, FileOperation
18
 
 
99
  pytoml.dump(config, f)
100
  return gr.Button("配置已保存")
101
 
102
+ @spaces.GPU
103
  def get_ready(query:str,chunksize=None,k=None):
104
 
105
  with open(CONFIG_PATH, encoding='utf8') as f:
 
197
  retmax = retmax)
198
  articelfinder.initiallize()
199
  return update_repo()
200
+
201
  def delete_articles_repo():
202
  # 在这里运行生成数据库的函数
203
  repodir, workdir, _ = get_ready('repo_work')
 
244
 
245
  return new_options, jsonobj
246
 
247
+ @spaces.GPU
248
  def generate_database(chunksize:int,nclusters:str|list[str]):
249
  # 在这里运行生成数据库的函数
250
  repodir, workdir, _ = get_ready('repo_work')
 
279
  _, workdir, _ = get_ready('repo_work')
280
  if os.path.exists(workdir):
281
  shutil.rmtree(workdir)
 
282
  return gr.Textbox(label="数据库概况",lines =3,value = '数据库已删除',visible = True)
283
+
284
  def update_database_textbox():
285
  texts, _ = update_database_info()
286
  if texts == []:
 
297
  nclusters = jsonobj[chunksize]
298
  return gr.Dropdown(choices= nclusters)
299
 
300
+ @spaces.GPU
301
  def annotation(n,chunksize:int,nclusters:int,remote_ornot:bool):
302
  '''
303
  use llm to annotate cluster
 
337
 
338
  return '\n\n'.join([obj['annotation'] for obj in new_obj_list])
339
 
340
+ @spaces.GPU
341
  def inspiration(annotation:str,chunksize:int,nclusters:int,remote_ornot:bool):
342
  query = 'inspiration'
343
  if remote_ornot:
 
385
  else:
386
  urls.append(ref)
387
  return urls
388
+
389
+ @spaces.GPU
390
  def summarize_text(query,chunksize:int,remote_ornot:bool):
391
  if remote_ornot:
392
  backend = 'remote'
deepdoc/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/deepdoc/__pycache__/__init__.cpython-310.pyc and b/deepdoc/__pycache__/__init__.cpython-310.pyc differ
 
deepdoc/parser/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/deepdoc/parser/__pycache__/__init__.cpython-310.pyc and b/deepdoc/parser/__pycache__/__init__.cpython-310.pyc differ
 
deepdoc/parser/__pycache__/pdf_parser.cpython-310.pyc CHANGED
Binary files a/deepdoc/parser/__pycache__/pdf_parser.cpython-310.pyc and b/deepdoc/parser/__pycache__/pdf_parser.cpython-310.pyc differ
 
deepdoc/utils/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/deepdoc/utils/__pycache__/__init__.cpython-310.pyc and b/deepdoc/utils/__pycache__/__init__.cpython-310.pyc differ
 
deepdoc/utils/__pycache__/file_utils.cpython-310.pyc CHANGED
Binary files a/deepdoc/utils/__pycache__/file_utils.cpython-310.pyc and b/deepdoc/utils/__pycache__/file_utils.cpython-310.pyc differ
 
deepdoc/utils/__pycache__/log_utils.cpython-310.pyc CHANGED
Binary files a/deepdoc/utils/__pycache__/log_utils.cpython-310.pyc and b/deepdoc/utils/__pycache__/log_utils.cpython-310.pyc differ
 
deepdoc/utils/__pycache__/rag_tokenizer.cpython-310.pyc CHANGED
Binary files a/deepdoc/utils/__pycache__/rag_tokenizer.cpython-310.pyc and b/deepdoc/utils/__pycache__/rag_tokenizer.cpython-310.pyc differ
 
deepdoc/vision/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/deepdoc/vision/__pycache__/__init__.cpython-310.pyc and b/deepdoc/vision/__pycache__/__init__.cpython-310.pyc differ
 
deepdoc/vision/__pycache__/layout_recognizer.cpython-310.pyc CHANGED
Binary files a/deepdoc/vision/__pycache__/layout_recognizer.cpython-310.pyc and b/deepdoc/vision/__pycache__/layout_recognizer.cpython-310.pyc differ
 
deepdoc/vision/__pycache__/ocr.cpython-310.pyc CHANGED
Binary files a/deepdoc/vision/__pycache__/ocr.cpython-310.pyc and b/deepdoc/vision/__pycache__/ocr.cpython-310.pyc differ
 
deepdoc/vision/__pycache__/operators.cpython-310.pyc CHANGED
Binary files a/deepdoc/vision/__pycache__/operators.cpython-310.pyc and b/deepdoc/vision/__pycache__/operators.cpython-310.pyc differ
 
deepdoc/vision/__pycache__/postprocess.cpython-310.pyc CHANGED
Binary files a/deepdoc/vision/__pycache__/postprocess.cpython-310.pyc and b/deepdoc/vision/__pycache__/postprocess.cpython-310.pyc differ
 
deepdoc/vision/__pycache__/recognizer.cpython-310.pyc CHANGED
Binary files a/deepdoc/vision/__pycache__/recognizer.cpython-310.pyc and b/deepdoc/vision/__pycache__/recognizer.cpython-310.pyc differ
 
deepdoc/vision/__pycache__/table_structure_recognizer.cpython-310.pyc CHANGED
Binary files a/deepdoc/vision/__pycache__/table_structure_recognizer.cpython-310.pyc and b/deepdoc/vision/__pycache__/table_structure_recognizer.cpython-310.pyc differ
 
huixiangdou/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/huixiangdou/__pycache__/__init__.cpython-310.pyc and b/huixiangdou/__pycache__/__init__.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/__init__.cpython-310.pyc and b/huixiangdou/service/__pycache__/__init__.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/cluster.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/cluster.cpython-310.pyc and b/huixiangdou/service/__pycache__/cluster.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/config.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/config.cpython-310.pyc and b/huixiangdou/service/__pycache__/config.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/feature_store.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/feature_store.cpython-310.pyc and b/huixiangdou/service/__pycache__/feature_store.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/file_operation.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/file_operation.cpython-310.pyc and b/huixiangdou/service/__pycache__/file_operation.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/findarticles.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/findarticles.cpython-310.pyc and b/huixiangdou/service/__pycache__/findarticles.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/helper.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/helper.cpython-310.pyc and b/huixiangdou/service/__pycache__/helper.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/llm_client.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/llm_client.cpython-310.pyc and b/huixiangdou/service/__pycache__/llm_client.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/llm_server_hybrid.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/llm_server_hybrid.cpython-310.pyc and b/huixiangdou/service/__pycache__/llm_server_hybrid.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/retriever.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/retriever.cpython-310.pyc and b/huixiangdou/service/__pycache__/retriever.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/sg_search.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/sg_search.cpython-310.pyc and b/huixiangdou/service/__pycache__/sg_search.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/web_search.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/web_search.cpython-310.pyc and b/huixiangdou/service/__pycache__/web_search.cpython-310.pyc differ
 
huixiangdou/service/__pycache__/worker.cpython-310.pyc CHANGED
Binary files a/huixiangdou/service/__pycache__/worker.cpython-310.pyc and b/huixiangdou/service/__pycache__/worker.cpython-310.pyc differ