Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,10 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
from datetime import datetime
|
4 |
import pytz # This library is used for timezone conversions
|
5 |
|
6 |
-
def
|
7 |
df = pd.read_csv(file.name)
|
8 |
|
9 |
# Define supplier-specific filters
|
@@ -11,8 +12,8 @@ def display_csv(file, supplier, order_number):
|
|
11 |
"Supplier 1": lambda df: df[~df['Vendor'].isin(["Seed", "EverColor", "Candy Magic", "OLENS", "Fairy", "Shobido", "Geo Medical", "Ann365", "Lenstown", "LensVery"])],
|
12 |
"Supplier 2": lambda df: df[df['Vendor'].isin(["Candy Magic", "OLENS", "Fairy", "Shobido"])],
|
13 |
"Supplier 3": lambda df: df[df['Vendor'].isin(["Seed", "EverColor"])],
|
14 |
-
"Supplier 4": lambda df: df[df['Vendor']
|
15 |
-
"Supplier 5": lambda df: df[df['Vendor']
|
16 |
}
|
17 |
|
18 |
# Apply supplier filter if selected
|
@@ -60,7 +61,7 @@ with gr.Blocks() as demo:
|
|
60 |
output_file = gr.File(label="Download Filtered CSV")
|
61 |
|
62 |
# Bind the function to inputs and outputs using the button
|
63 |
-
load_button.click(fn=
|
64 |
|
65 |
# Run the interface
|
66 |
demo.launch()
|
|
|
1 |
+
###ORDER###
|
2 |
import gradio as gr
|
3 |
import pandas as pd
|
4 |
from datetime import datetime
|
5 |
import pytz # This library is used for timezone conversions
|
6 |
|
7 |
+
def order_csv(file, supplier, order_number):
|
8 |
df = pd.read_csv(file.name)
|
9 |
|
10 |
# Define supplier-specific filters
|
|
|
12 |
"Supplier 1": lambda df: df[~df['Vendor'].isin(["Seed", "EverColor", "Candy Magic", "OLENS", "Fairy", "Shobido", "Geo Medical", "Ann365", "Lenstown", "LensVery"])],
|
13 |
"Supplier 2": lambda df: df[df['Vendor'].isin(["Candy Magic", "OLENS", "Fairy", "Shobido"])],
|
14 |
"Supplier 3": lambda df: df[df['Vendor'].isin(["Seed", "EverColor"])],
|
15 |
+
"Supplier 4": lambda df: df[df['Vendor'].isin(["Geo Medical", "Lenstown"])],
|
16 |
+
"Supplier 5": lambda df: df[df['Vendor'].isin(["Ann365", "LensVery"])]
|
17 |
}
|
18 |
|
19 |
# Apply supplier filter if selected
|
|
|
61 |
output_file = gr.File(label="Download Filtered CSV")
|
62 |
|
63 |
# Bind the function to inputs and outputs using the button
|
64 |
+
load_button.click(fn=order_csv, inputs=[file_input, supplier_input, order_number_input], outputs=[output_df, output_file])
|
65 |
|
66 |
# Run the interface
|
67 |
demo.launch()
|