Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,15 @@ import gradio as gr
|
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
def process_excel(file):
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Define the Gradio interface
|
| 11 |
interface = gr.Interface(
|
|
@@ -18,4 +23,4 @@ interface = gr.Interface(
|
|
| 18 |
|
| 19 |
# Launch the interface
|
| 20 |
if __name__ == "__main__":
|
| 21 |
-
interface.launch()
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
def process_excel(file):
|
| 5 |
+
try:
|
| 6 |
+
# Ensure the file path is correct
|
| 7 |
+
file_path = file.name if hasattr(file, 'name') else file
|
| 8 |
+
# Read the Excel file
|
| 9 |
+
df = pd.read_excel(file_path)
|
| 10 |
+
# Perform any processing on the DataFrame here
|
| 11 |
+
return df.head() # Return the first few rows as an example
|
| 12 |
+
except Exception as e:
|
| 13 |
+
return str(e) # Return the error message
|
| 14 |
|
| 15 |
# Define the Gradio interface
|
| 16 |
interface = gr.Interface(
|
|
|
|
| 23 |
|
| 24 |
# Launch the interface
|
| 25 |
if __name__ == "__main__":
|
| 26 |
+
interface.launch()
|