Spaces:
Runtime error
Runtime error
import os | |
import subprocess | |
import gradio as gr | |
# Run the setup script to install unoconv and libreoffice | |
subprocess.run(['bash', 'setup.sh'], check=True) | |
# Function to convert PowerPoint to PDF using unoconv | |
def pptx_to_pdf(input_pptx): | |
output_pdf = "output.pdf" | |
subprocess.run(['unoconv', '-f', 'pdf', '-o', output_pdf, input_pptx], check=True) | |
return output_pdf | |
# Gradio interface for converting PPTX to PDF | |
pptx_to_pdf_interface = gr.Interface( | |
fn=pptx_to_pdf, | |
inputs=gr.File(label="Upload PPTX File", file_count="single"), | |
outputs=gr.File(label="Download PDF File"), | |
title="Convert PPTX to PDF" | |
) | |
# Launch the Gradio app | |
if __name__ == "__main__": | |
pptx_to_pdf_interface.launch(share=True) | |