Giacomo Vianello commited on
Commit
a10d2b2
·
unverified ·
1 Parent(s): ad33ef9

Reorganize

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -2
  2. app.py +14 -6
Dockerfile CHANGED
@@ -15,5 +15,3 @@ WORKDIR $HOME/app
15
  COPY --chown=user . $HOME/app
16
 
17
  ENTRYPOINT python app.py
18
-
19
- # sbt "runMain org.allenai.pdffigures2.FigureExtractorBatchCli 2304.11968v1.Track_Anything_Segment_Anything_Meets_Videos.pdf -m figures -t 48 -q"
 
15
  COPY --chown=user . $HOME/app
16
 
17
  ENTRYPOINT python app.py
 
 
app.py CHANGED
@@ -29,12 +29,20 @@ def extract_figure(url):
29
  # return first figure
30
  return figure_path
31
 
 
 
 
32
  # define input and output interfaces
33
- inputs = gr.inputs.Textbox(label="Enter URL of PDF file:")
34
- outputs = gr.outputs.Image(label="First figure in PDF:", type="filepath")
 
 
 
 
 
 
 
35
 
36
- # create interface
37
- interface = gr.Interface(fn=extract_figure, inputs=inputs, outputs=outputs, title="Extract First Figure from PDF", description="Enter the URL of a PDF file and the first figure in the file will be extracted and displayed.")
38
 
39
- # launch interface
40
- interface.launch()
 
29
  # return first figure
30
  return figure_path
31
 
32
+
33
+ def run():
34
+
35
  # define input and output interfaces
36
+ inputs = gr.inputs.Textbox(label="Enter URL of PDF file:")
37
+ outputs = gr.outputs.Image(label="First figure in PDF:", type="filepath")
38
+
39
+ # create interface
40
+ interface = gr.Interface(fn=extract_figure, inputs=inputs, outputs=outputs, title="Extract First Figure from PDF", description="Enter the URL of a PDF file and the first figure in the file will be extracted and displayed.")
41
+
42
+ # launch interface
43
+ interface.launch(server_name="0.0.0.0", server_port=7860)
44
+
45
 
46
+ if __name__ == "__main__":
 
47
 
48
+ run()