Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,23 +46,25 @@ def get_name(pec_number, df):
|
|
46 |
print("PEC Number not found.") # Debugging output
|
47 |
return "PEC Number not found."
|
48 |
|
49 |
-
# Function to
|
50 |
-
def
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
56 |
|
57 |
-
# Combine
|
58 |
def predict(pec_number):
|
59 |
try:
|
60 |
# Load the dataset from the root directory
|
61 |
df = load_dataset()
|
62 |
|
63 |
name = get_name(pec_number, df)
|
64 |
-
|
65 |
-
return f"Name: {name}" #
|
66 |
except Exception as e:
|
67 |
print(f"An error occurred: {e}")
|
68 |
return f"Error: {e}"
|
@@ -70,10 +72,10 @@ def predict(pec_number):
|
|
70 |
# Build the Gradio interface without the file upload option
|
71 |
iface = gr.Interface(
|
72 |
fn=predict,
|
73 |
-
inputs=gr.Textbox(lines=1, placeholder="Enter PEC Number
|
74 |
outputs="text",
|
75 |
title="PEC Number to Name Lookup",
|
76 |
-
description="Enter a PEC number to retrieve the corresponding name."
|
77 |
)
|
78 |
|
79 |
# Run the Gradio interface
|
|
|
46 |
print("PEC Number not found.") # Debugging output
|
47 |
return "PEC Number not found."
|
48 |
|
49 |
+
# Function to check if the PEC number is attached
|
50 |
+
def check_pec_number(pec_number, df):
|
51 |
+
df['PEC No.'] = df['PEC No.'].str.strip().str.upper()
|
52 |
+
pec_number = pec_number.strip().upper()
|
53 |
+
|
54 |
+
if pec_number in df['PEC No.'].values:
|
55 |
+
return "Your PEC Number is Attached."
|
56 |
+
else:
|
57 |
+
return "Your PEC Number is Not Attached."
|
58 |
|
59 |
+
# Combine the functions to create a prediction
|
60 |
def predict(pec_number):
|
61 |
try:
|
62 |
# Load the dataset from the root directory
|
63 |
df = load_dataset()
|
64 |
|
65 |
name = get_name(pec_number, df)
|
66 |
+
pec_status = check_pec_number(pec_number, df)
|
67 |
+
return f"Your Name is: {name}\n{pec_status}" # Return name and PEC status
|
68 |
except Exception as e:
|
69 |
print(f"An error occurred: {e}")
|
70 |
return f"Error: {e}"
|
|
|
72 |
# Build the Gradio interface without the file upload option
|
73 |
iface = gr.Interface(
|
74 |
fn=predict,
|
75 |
+
inputs=gr.Textbox(lines=1, placeholder="**Enter PEC Number...**"), # Bold placeholder text
|
76 |
outputs="text",
|
77 |
title="PEC Number to Name Lookup",
|
78 |
+
description="Enter a PEC number to retrieve the corresponding name and check if your PEC number is attached."
|
79 |
)
|
80 |
|
81 |
# Run the Gradio interface
|