sidphbot commited on
Commit
da318a3
1 Parent(s): 440f11d

print fix, title model switch

Browse files
Files changed (3) hide show
  1. app.py +4 -1
  2. src/Surveyor.py +39 -35
  3. src/defaults.py +2 -2
app.py CHANGED
@@ -42,6 +42,9 @@ def survey_space(surveyor):
42
 
43
  if __name__ == '__main__':
44
  st.container().title('Auto-Research V0.1 - Automated Survey generation from research keywords')
 
 
 
45
  global surveyor
46
- surveyor_obj = Surveyor(print_fn=st.write)
47
  survey_space(surveyor_obj)
 
42
 
43
  if __name__ == '__main__':
44
  st.container().title('Auto-Research V0.1 - Automated Survey generation from research keywords')
45
+ std_col, survey_col = st.columns(2)
46
+ std_col.header('execution log:')
47
+ survey_col.header('Generated_survey:')
48
  global surveyor
49
+ surveyor_obj = Surveyor(print_fn=std_col.write, survey_print_fn=survey_col.write)
50
  survey_space(surveyor_obj)
src/Surveyor.py CHANGED
@@ -45,7 +45,8 @@ class Surveyor:
45
  high_gpu=False,
46
  refresh_models=False,
47
  no_save_models=False,
48
- print_fn=None
 
49
  ):
50
  '''
51
  Initializes models and directory structure for the surveyor
@@ -75,6 +76,9 @@ class Surveyor:
75
  self.print_fn = print
76
  if print_fn is not None:
77
  self.print_fn = print_fn
 
 
 
78
 
79
  self.torch_device = 'cpu'
80
  self.print_fn("\nTorch_device: " + self.torch_device)
@@ -342,82 +346,82 @@ class Surveyor:
342
  query = 'Internal(existing) research'
343
  file.write("----------------------------------------------------------------------")
344
  file.write("Title: A survey on " + query)
345
- self.print_fn("")
346
- self.print_fn("----------------------------------------------------------------------")
347
- self.print_fn("Title: A survey on " + query)
348
  file.write("Author: Auto-Research (github.com/sidphbot/Auto-Research)")
349
- self.print_fn("Author: Auto-Research (github.com/sidphbot/Auto-Research)")
350
  file.write("Dev: Auto-Research (github.com/sidphbot/Auto-Research)")
351
- self.print_fn("Dev: Auto-Research (github.com/sidphbot/Auto-Research)")
352
  file.write("Disclaimer: This survey is intended to be a research starter. This Survey is Machine-Summarized, "+
353
  "\nhence some sentences might be wrangled or grammatically incorrect. However all sentences are "+
354
  "\nmined with proper citations. As All of the text is practically quoted texted, hence to "+
355
  "\nimprove visibility, all the papers are duly cited in the Bibiliography section. as bibtex "+
356
  "\nentries(only to avoid LaTex overhead). ")
357
- self.print_fn("Disclaimer: This survey is intended to be a research starter. This Survey is Machine-Summarized, "+
358
  "\nhence some sentences might be wrangled or grammatically incorrect. However all sentences are "+
359
  "\nmined with proper citations. As All of the text is practically quoted texted, hence to "+
360
  "\nimprove visibility, all the papers are duly cited in the Bibiliography section. as bibtex "+
361
  "\nentries(only to avoid LaTex overhead). ")
362
  file.write("----------------------------------------------------------------------")
363
- self.print_fn("----------------------------------------------------------------------")
364
  file.write("")
365
- self.print_fn("")
366
  file.write('ABSTRACT')
367
- self.print_fn('ABSTRACT')
368
- self.print_fn("=================================================")
369
  file.write("=================================================")
370
  file.write("")
371
- self.print_fn("")
372
  file.write(research_sections['abstract'])
373
- self.print_fn(research_sections['abstract'])
374
  file.write("")
375
- self.print_fn("")
376
  file.write('INTRODUCTION')
377
- self.print_fn('INTRODUCTION')
378
- self.print_fn("=================================================")
379
  file.write("=================================================")
380
  file.write("")
381
- self.print_fn("")
382
  file.write(research_sections['introduction'])
383
- self.print_fn(research_sections['introduction'])
384
  file.write("")
385
- self.print_fn("")
386
  for k, v in research_sections.items():
387
  if k not in ['abstract', 'introduction', 'conclusion']:
388
  file.write(k.upper())
389
- self.print_fn(k.upper())
390
- self.print_fn("=================================================")
391
  file.write("=================================================")
392
  file.write("")
393
- self.print_fn("")
394
  file.write(v)
395
- self.print_fn(v)
396
  file.write("")
397
- self.print_fn("")
398
  file.write('CONCLUSION')
399
- self.print_fn('CONCLUSION')
400
- self.print_fn("=================================================")
401
  file.write("=================================================")
402
  file.write("")
403
- self.print_fn("")
404
  file.write(research_sections['conclusion'])
405
- self.print_fn(research_sections['conclusion'])
406
  file.write("")
407
- self.print_fn("")
408
 
409
  file.write('REFERENCES')
410
- self.print_fn('REFERENCES')
411
- self.print_fn("=================================================")
412
  file.write("=================================================")
413
  file.write("")
414
- self.print_fn("")
415
  for entry in bibentries:
416
  file.write(entry)
417
- self.print_fn(entry)
418
  file.write("")
419
- self.print_fn("")
420
- self.print_fn("========================XXX=========================")
421
  file.write("========================XXX=========================")
422
  file.close()
423
 
 
45
  high_gpu=False,
46
  refresh_models=False,
47
  no_save_models=False,
48
+ print_fn=None,
49
+ survey_print_fn=None
50
  ):
51
  '''
52
  Initializes models and directory structure for the surveyor
 
76
  self.print_fn = print
77
  if print_fn is not None:
78
  self.print_fn = print_fn
79
+ self.survey_print_fn = self.print_fn
80
+ if survey_print_fn is not None:
81
+ self.survey_print_fn = survey_print_fn
82
 
83
  self.torch_device = 'cpu'
84
  self.print_fn("\nTorch_device: " + self.torch_device)
 
346
  query = 'Internal(existing) research'
347
  file.write("----------------------------------------------------------------------")
348
  file.write("Title: A survey on " + query)
349
+ self.survey_print_fn("")
350
+ self.survey_print_fn("----------------------------------------------------------------------")
351
+ self.survey_print_fn("Title: A survey on " + query)
352
  file.write("Author: Auto-Research (github.com/sidphbot/Auto-Research)")
353
+ self.survey_print_fn("Author: Auto-Research (github.com/sidphbot/Auto-Research)")
354
  file.write("Dev: Auto-Research (github.com/sidphbot/Auto-Research)")
355
+ self.survey_print_fn("Dev: Auto-Research (github.com/sidphbot/Auto-Research)")
356
  file.write("Disclaimer: This survey is intended to be a research starter. This Survey is Machine-Summarized, "+
357
  "\nhence some sentences might be wrangled or grammatically incorrect. However all sentences are "+
358
  "\nmined with proper citations. As All of the text is practically quoted texted, hence to "+
359
  "\nimprove visibility, all the papers are duly cited in the Bibiliography section. as bibtex "+
360
  "\nentries(only to avoid LaTex overhead). ")
361
+ self.survey_print_fn("Disclaimer: This survey is intended to be a research starter. This Survey is Machine-Summarized, "+
362
  "\nhence some sentences might be wrangled or grammatically incorrect. However all sentences are "+
363
  "\nmined with proper citations. As All of the text is practically quoted texted, hence to "+
364
  "\nimprove visibility, all the papers are duly cited in the Bibiliography section. as bibtex "+
365
  "\nentries(only to avoid LaTex overhead). ")
366
  file.write("----------------------------------------------------------------------")
367
+ self.survey_print_fn("----------------------------------------------------------------------")
368
  file.write("")
369
+ self.survey_print_fn("")
370
  file.write('ABSTRACT')
371
+ self.survey_print_fn('ABSTRACT')
372
+ self.survey_print_fn("=================================================")
373
  file.write("=================================================")
374
  file.write("")
375
+ self.survey_print_fn("")
376
  file.write(research_sections['abstract'])
377
+ self.survey_print_fn(research_sections['abstract'])
378
  file.write("")
379
+ self.survey_print_fn("")
380
  file.write('INTRODUCTION')
381
+ self.survey_print_fn('INTRODUCTION')
382
+ self.survey_print_fn("=================================================")
383
  file.write("=================================================")
384
  file.write("")
385
+ self.survey_print_fn("")
386
  file.write(research_sections['introduction'])
387
+ self.survey_print_fn(research_sections['introduction'])
388
  file.write("")
389
+ self.survey_print_fn("")
390
  for k, v in research_sections.items():
391
  if k not in ['abstract', 'introduction', 'conclusion']:
392
  file.write(k.upper())
393
+ self.survey_print_fn(k.upper())
394
+ self.survey_print_fn("=================================================")
395
  file.write("=================================================")
396
  file.write("")
397
+ self.survey_print_fn("")
398
  file.write(v)
399
+ self.survey_print_fn(v)
400
  file.write("")
401
+ self.survey_print_fn("")
402
  file.write('CONCLUSION')
403
+ self.survey_print_fn('CONCLUSION')
404
+ self.survey_print_fn("=================================================")
405
  file.write("=================================================")
406
  file.write("")
407
+ self.survey_print_fn("")
408
  file.write(research_sections['conclusion'])
409
+ self.survey_print_fn(research_sections['conclusion'])
410
  file.write("")
411
+ self.survey_print_fn("")
412
 
413
  file.write('REFERENCES')
414
+ self.survey_print_fn('REFERENCES')
415
+ self.survey_print_fn("=================================================")
416
  file.write("=================================================")
417
  file.write("")
418
+ self.survey_print_fn("")
419
  for entry in bibentries:
420
  file.write(entry)
421
+ self.survey_print_fn(entry)
422
  file.write("")
423
+ self.survey_print_fn("")
424
+ self.survey_print_fn("========================XXX=========================")
425
  file.write("========================XXX=========================")
426
  file.close()
427
 
src/defaults.py CHANGED
@@ -28,9 +28,9 @@ DEFAULTS_CPU_COMPAT = {
28
  "tab_dir": "arxiv_data/tables/",
29
  "dump_dir": "arxiv_dumps/",
30
  "models_dir": "saved_models/",
31
- "title_model_name": "ccdv/lsg-bart-base-4096-arxiv",
32
  "ex_summ_model_name": "allenai/scibert_scivocab_uncased",
33
- "ledmodel_name": "bhuvaneswari/t5-small-text_summarization",
34
  "embedder_name": "paraphrase-MiniLM-L6-v2",
35
  "nlp_name": "en_core_sci_scibert",
36
  "similarity_nlp_name": "en_core_sci_lg",
 
28
  "tab_dir": "arxiv_data/tables/",
29
  "dump_dir": "arxiv_dumps/",
30
  "models_dir": "saved_models/",
31
+ "title_model_name": "Callidior/bert2bert-base-arxiv-titlegen",
32
  "ex_summ_model_name": "allenai/scibert_scivocab_uncased",
33
+ "ledmodel_name": "ccdv/lsg-bart-base-4096-arxiv",
34
  "embedder_name": "paraphrase-MiniLM-L6-v2",
35
  "nlp_name": "en_core_sci_scibert",
36
  "similarity_nlp_name": "en_core_sci_lg",