Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -1,16 +1,30 @@
1
  import gradio as gr
2
  from grobid_client.grobid_client import GrobidClient
3
 
 
4
  def extract_text(file):
5
  client = GrobidClient(config_path="./config.json")
6
- information = client.process_pdf("processFulltextDocument", file.name, generateIDs=False, consolidate_header=False, consolidate_citations=False, include_raw_citations=False, include_raw_affiliations=False, tei_coordinates=False, segment_sentences=False)
 
 
 
 
 
 
 
 
 
 
7
  return information
8
 
9
- #Ask Dr Ahmad about which LLM to use and if we have a token for it
 
10
  with gr.Blocks() as demo:
11
- file_input = gr.File(label="Upload a research paper as a pdf file", file_types=[".pdf"])
 
 
12
  text_output = gr.Textbox(label="Extracted Text")
13
-
14
- file_input.change(fn=extract_text, inputs=file_input, outputs=text_output)
15
 
16
- demo.launch()
 
 
 
1
  import gradio as gr
2
  from grobid_client.grobid_client import GrobidClient
3
 
4
+
5
  def extract_text(file):
6
  client = GrobidClient(config_path="./config.json")
7
+ information = client.process_pdf(
8
+ "processFulltextDocument",
9
+ file.name,
10
+ generateIDs=False,
11
+ consolidate_header=False,
12
+ consolidate_citations=False,
13
+ include_raw_citations=False,
14
+ include_raw_affiliations=False,
15
+ tei_coordinates=False,
16
+ segment_sentences=False,
17
+ )
18
  return information
19
 
20
+
21
+ # Ask Dr Ahmad about which LLM to use and if we have a token for it
22
  with gr.Blocks() as demo:
23
+ file_input = gr.File(
24
+ label="Upload a research paper as a pdf file", file_types=[".pdf"]
25
+ )
26
  text_output = gr.Textbox(label="Extracted Text")
 
 
27
 
28
+ file_input.upload(fn=extract_text, inputs=file_input, outputs=text_output)
29
+
30
+ demo.launch()