Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,18 +46,18 @@ def create_excel(doc):
|
|
| 46 |
data[HEADERS[idx_col]].append(None)
|
| 47 |
idx_col = idx_col + 1
|
| 48 |
# SHOW THE RECOVERED DATA
|
| 49 |
-
print(data)
|
| 50 |
df_table = pd.DataFrame.from_dict(data)
|
| 51 |
-
|
| 52 |
|
| 53 |
def upload_file(filepath):
|
|
|
|
| 54 |
name = Path(filepath).name
|
| 55 |
# load pdf
|
| 56 |
doc = fitz.open(filepath)
|
| 57 |
-
|
| 58 |
-
print(df_table)
|
| 59 |
# now create the excel file
|
| 60 |
-
return [gr.UploadButton(visible=False), gr.DownloadButton(label=f"Download tabla.xlsx", value=
|
| 61 |
|
| 62 |
def download_file():
|
| 63 |
return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
|
|
|
|
| 46 |
data[HEADERS[idx_col]].append(None)
|
| 47 |
idx_col = idx_col + 1
|
| 48 |
# SHOW THE RECOVERED DATA
|
| 49 |
+
#print(data)
|
| 50 |
df_table = pd.DataFrame.from_dict(data)
|
| 51 |
+
df_table.to_excel("tabla.xlsx", index=False)
|
| 52 |
|
| 53 |
def upload_file(filepath):
|
| 54 |
+
print(filepath)
|
| 55 |
name = Path(filepath).name
|
| 56 |
# load pdf
|
| 57 |
doc = fitz.open(filepath)
|
| 58 |
+
create_excel(doc)
|
|
|
|
| 59 |
# now create the excel file
|
| 60 |
+
return [gr.UploadButton(visible=False), gr.DownloadButton(label=f"Download tabla.xlsx", value="tabla.xlsx", visible=True)]
|
| 61 |
|
| 62 |
def download_file():
|
| 63 |
return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
|