Update app.py
Browse files
app.py
CHANGED
|
@@ -2,13 +2,15 @@ import gradio as gr
|
|
| 2 |
import pandas as pd
|
| 3 |
import tempfile
|
| 4 |
import os
|
|
|
|
| 5 |
|
|
|
|
| 6 |
def reconcile_files(file1, file2):
|
| 7 |
if not file1 or not file2:
|
| 8 |
return "⚠️ Please upload both files.", None, None, None
|
| 9 |
|
| 10 |
try:
|
| 11 |
-
# Load Data
|
| 12 |
df1 = pd.read_excel(file1.name) if file1.name.endswith('.xlsx') else pd.read_csv(file1.name)
|
| 13 |
df2 = pd.read_excel(file2.name) if file2.name.endswith('.xlsx') else pd.read_csv(file2.name)
|
| 14 |
|
|
@@ -62,7 +64,7 @@ def reconcile_files(file1, file2):
|
|
| 62 |
return f"❌ An error occurred: {str(e)}", None, None, None
|
| 63 |
|
| 64 |
# --- Build the Gradio Web Interface ---
|
| 65 |
-
with gr.Blocks(
|
| 66 |
gr.Markdown("# 📊 Sales vs SAP Reconciliation Tool")
|
| 67 |
gr.Markdown("Upload your files below to generate the matched and missing datasets.")
|
| 68 |
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import tempfile
|
| 4 |
import os
|
| 5 |
+
import spaces
|
| 6 |
|
| 7 |
+
@spaces.GPU
|
| 8 |
def reconcile_files(file1, file2):
|
| 9 |
if not file1 or not file2:
|
| 10 |
return "⚠️ Please upload both files.", None, None, None
|
| 11 |
|
| 12 |
try:
|
| 13 |
+
# Load Data
|
| 14 |
df1 = pd.read_excel(file1.name) if file1.name.endswith('.xlsx') else pd.read_csv(file1.name)
|
| 15 |
df2 = pd.read_excel(file2.name) if file2.name.endswith('.xlsx') else pd.read_csv(file2.name)
|
| 16 |
|
|
|
|
| 64 |
return f"❌ An error occurred: {str(e)}", None, None, None
|
| 65 |
|
| 66 |
# --- Build the Gradio Web Interface ---
|
| 67 |
+
with gr.Blocks() as demo:
|
| 68 |
gr.Markdown("# 📊 Sales vs SAP Reconciliation Tool")
|
| 69 |
gr.Markdown("Upload your files below to generate the matched and missing datasets.")
|
| 70 |
|