ysharma HF staff commited on
Commit
6bd383d
1 Parent(s): 1e06a50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -1,4 +1,25 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  with gr.Blocks() as demo:
4
 
@@ -8,6 +29,9 @@ with gr.Blocks() as demo:
8
  pdf_link = gr.Textbox(placeholder='Enter an arxiv link here', label='Provide a link', scale=1)
9
 
10
  with gr.Row():
 
11
  parsed_output = gr.Textbox(lines=5)
12
 
 
 
13
  demo.launch(debug=True)
 
1
  import gradio as gr
2
+ import subprocess
3
+
4
+ def fun(filepath):
5
+ print(f"filepath is - {filepath}")
6
+ # Command to run
7
+ bash_command = f"nougat {filepath}"
8
+
9
+ # Run the command and capture its output
10
+ completed_process = subprocess.run(bash_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
11
+
12
+ # Get the output and error messages
13
+ output = completed_process.stdout
14
+ errors = completed_process.stderr
15
+
16
+ # Print the output and errors
17
+ print("Output:")
18
+ print(len(output))
19
+
20
+ print("Errors:")
21
+ print(len(errors))
22
+ return output
23
 
24
  with gr.Blocks() as demo:
25
 
 
29
  pdf_link = gr.Textbox(placeholder='Enter an arxiv link here', label='Provide a link', scale=1)
30
 
31
  with gr.Row():
32
+ btn = gr.Button()
33
  parsed_output = gr.Textbox(lines=5)
34
 
35
+ btn.click(fun, pdf_file, parsed_output)
36
+
37
  demo.launch(debug=True)