pdf_converter / app.py
daswer123's picture
Upload 3 files
e1cf46f verified
raw
history blame contribute delete
736 Bytes
from datetime import datetime
import os
import gradio as gr
from funcs import pdf_to_epub
def greet(file):
try:
print(f"Received file: {file}")
# Create folder result
os.makedirs("result", exist_ok=True)
timestamp_formated = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
result_file = os.path.join("result", timestamp_formated+".epub")
file = pdf_to_epub(file, "output.epub")
except Exception as e:
print(f"Error: {e}")
return "Error", None
return "Завершенно","output.epub"
demo = gr.Interface(
fn=greet,
inputs=["file",],
outputs=["label","file"],
allow_flagging=False
)
demo.launch()