Spaces:
Paused
Paused
File size: 997 Bytes
c9e6420 6bd383d c9e6420 1e06a50 c9e6420 6bd383d c9e6420 6bd383d c9e6420 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import gradio as gr
import subprocess
def fun(filepath):
print(f"filepath is - {filepath}")
# Command to run
bash_command = f"nougat {filepath}"
# Run the command and capture its output
completed_process = subprocess.run(bash_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
# Get the output and error messages
output = completed_process.stdout
errors = completed_process.stderr
# Print the output and errors
print("Output:")
print(len(output))
print("Errors:")
print(len(errors))
return output
with gr.Blocks() as demo:
with gr.Row():
pdf_file = gr.File(label='Upload a PDF', scale=1)
mkd = gr.HTML(' <i>OR</i> ', scale=1)
pdf_link = gr.Textbox(placeholder='Enter an arxiv link here', label='Provide a link', scale=1)
with gr.Row():
btn = gr.Button()
parsed_output = gr.Textbox(lines=5)
btn.click(fun, pdf_file, parsed_output)
demo.launch(debug=True)
|