Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -93,7 +93,10 @@ def process_data(file_obj, column_name: str):
|
|
93 |
|
94 |
try:
|
95 |
# Read input file
|
96 |
-
|
|
|
|
|
|
|
97 |
|
98 |
# Validate column exists
|
99 |
if column_name not in df.columns:
|
@@ -143,7 +146,6 @@ with gr.Blocks(
|
|
143 |
with gr.Column(scale=1):
|
144 |
file_input = gr.File(
|
145 |
label="Upload Excel File",
|
146 |
-
type="file",
|
147 |
file_types=[".xlsx", ".xls"]
|
148 |
)
|
149 |
column_input = gr.Textbox(
|
@@ -181,8 +183,4 @@ with gr.Blocks(
|
|
181 |
|
182 |
# Launch settings
|
183 |
if __name__ == "__main__":
|
184 |
-
app.launch(
|
185 |
-
server_name="0.0.0.0",
|
186 |
-
server_port=7860,
|
187 |
-
share=False
|
188 |
-
)
|
|
|
93 |
|
94 |
try:
|
95 |
# Read input file
|
96 |
+
if hasattr(file_obj, 'name'): # Gradio file object
|
97 |
+
df = pd.read_excel(file_obj.name)
|
98 |
+
else: # Path string or bytes
|
99 |
+
df = pd.read_excel(file_obj)
|
100 |
|
101 |
# Validate column exists
|
102 |
if column_name not in df.columns:
|
|
|
146 |
with gr.Column(scale=1):
|
147 |
file_input = gr.File(
|
148 |
label="Upload Excel File",
|
|
|
149 |
file_types=[".xlsx", ".xls"]
|
150 |
)
|
151 |
column_input = gr.Textbox(
|
|
|
183 |
|
184 |
# Launch settings
|
185 |
if __name__ == "__main__":
|
186 |
+
app.launch()
|
|
|
|
|
|
|
|