Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import os
|
|
| 5 |
import numpy as np
|
| 6 |
import shutil
|
| 7 |
import uuid
|
|
|
|
| 8 |
|
| 9 |
# Initialize the PP-Structure table model once to avoid reloading for each request
|
| 10 |
table_engine = PPStructure(
|
|
@@ -37,9 +38,6 @@ def extract_table(image):
|
|
| 37 |
# Handle case where no table was detected
|
| 38 |
return "No table detected in the image."
|
| 39 |
|
| 40 |
-
# Clean up temporary files (optional)
|
| 41 |
-
# shutil.rmtree(save_folder)
|
| 42 |
-
|
| 43 |
# Define the Gradio interface
|
| 44 |
iface = gr.Interface(
|
| 45 |
fn=extract_table,
|
|
|
|
| 5 |
import numpy as np
|
| 6 |
import shutil
|
| 7 |
import uuid
|
| 8 |
+
from PIL import Image
|
| 9 |
|
| 10 |
# Initialize the PP-Structure table model once to avoid reloading for each request
|
| 11 |
table_engine = PPStructure(
|
|
|
|
| 38 |
# Handle case where no table was detected
|
| 39 |
return "No table detected in the image."
|
| 40 |
|
|
|
|
|
|
|
|
|
|
| 41 |
# Define the Gradio interface
|
| 42 |
iface = gr.Interface(
|
| 43 |
fn=extract_table,
|