Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from dog_breed import dog_breed_classification
|
|
5 |
from deepfake_vs_real import deepfake_classification
|
6 |
from gym_workout_classification import workout_classification
|
7 |
from augmented_waste_classifier import waste_classification
|
|
|
8 |
|
9 |
# Functions to update the model state when a button is clicked.
|
10 |
def select_gender():
|
@@ -25,6 +26,9 @@ def select_gym_workout():
|
|
25 |
def select_waste():
|
26 |
return "waste"
|
27 |
|
|
|
|
|
|
|
28 |
# Main classification function that calls the appropriate model based on selection.
|
29 |
def classify(image, model_name):
|
30 |
if model_name == "gender":
|
@@ -36,9 +40,11 @@ def classify(image, model_name):
|
|
36 |
elif model_name == "deepfake":
|
37 |
return deepfake_classification(image)
|
38 |
elif model_name == "gym workout":
|
39 |
-
return
|
40 |
elif model_name == "waste":
|
41 |
return waste_classification(image)
|
|
|
|
|
42 |
else:
|
43 |
return {"Error": "No model selected"}
|
44 |
|
@@ -47,6 +53,7 @@ with gr.Blocks() as demo:
|
|
47 |
with gr.Sidebar():
|
48 |
gr.Markdown("# SigLIP2 224")
|
49 |
with gr.Row():
|
|
|
50 |
gender_btn = gr.Button("Gender Classification")
|
51 |
emotion_btn = gr.Button("Emotion Classification")
|
52 |
dog_breed_btn = gr.Button("Dog Breed Classification")
|
@@ -55,7 +62,7 @@ with gr.Blocks() as demo:
|
|
55 |
waste_btn = gr.Button("Waste Classification")
|
56 |
|
57 |
# State to hold the current model choice.
|
58 |
-
selected_model = gr.State("
|
59 |
|
60 |
# Set model state when buttons are clicked.
|
61 |
gender_btn.click(fn=select_gender, inputs=[], outputs=selected_model)
|
@@ -64,6 +71,7 @@ with gr.Blocks() as demo:
|
|
64 |
deepfake_btn.click(fn=select_deepfake, inputs=[], outputs=selected_model)
|
65 |
gym_workout_btn.click(fn=select_gym_workout, inputs=[], outputs=selected_model)
|
66 |
waste_btn.click(fn=select_waste, inputs=[], outputs=selected_model)
|
|
|
67 |
|
68 |
gr.Markdown("### Current Model:")
|
69 |
model_display = gr.Textbox(value="gender", interactive=False)
|
|
|
5 |
from deepfake_vs_real import deepfake_classification
|
6 |
from gym_workout_classification import workout_classification
|
7 |
from augmented_waste_classifier import waste_classification
|
8 |
+
from age_classification import age_classification
|
9 |
|
10 |
# Functions to update the model state when a button is clicked.
|
11 |
def select_gender():
|
|
|
26 |
def select_waste():
|
27 |
return "waste"
|
28 |
|
29 |
+
def select_age():
|
30 |
+
return "age"
|
31 |
+
|
32 |
# Main classification function that calls the appropriate model based on selection.
|
33 |
def classify(image, model_name):
|
34 |
if model_name == "gender":
|
|
|
40 |
elif model_name == "deepfake":
|
41 |
return deepfake_classification(image)
|
42 |
elif model_name == "gym workout":
|
43 |
+
return workout_classification(image)
|
44 |
elif model_name == "waste":
|
45 |
return waste_classification(image)
|
46 |
+
elif model_name == "age":
|
47 |
+
return age_classification(image)
|
48 |
else:
|
49 |
return {"Error": "No model selected"}
|
50 |
|
|
|
53 |
with gr.Sidebar():
|
54 |
gr.Markdown("# SigLIP2 224")
|
55 |
with gr.Row():
|
56 |
+
age_btn = gr.Button("Age Classification")
|
57 |
gender_btn = gr.Button("Gender Classification")
|
58 |
emotion_btn = gr.Button("Emotion Classification")
|
59 |
dog_breed_btn = gr.Button("Dog Breed Classification")
|
|
|
62 |
waste_btn = gr.Button("Waste Classification")
|
63 |
|
64 |
# State to hold the current model choice.
|
65 |
+
selected_model = gr.State("age")
|
66 |
|
67 |
# Set model state when buttons are clicked.
|
68 |
gender_btn.click(fn=select_gender, inputs=[], outputs=selected_model)
|
|
|
71 |
deepfake_btn.click(fn=select_deepfake, inputs=[], outputs=selected_model)
|
72 |
gym_workout_btn.click(fn=select_gym_workout, inputs=[], outputs=selected_model)
|
73 |
waste_btn.click(fn=select_waste, inputs=[], outputs=selected_model)
|
74 |
+
age_btn.click(fn=select_age, inputs=[], outputs=selected_model)
|
75 |
|
76 |
gr.Markdown("### Current Model:")
|
77 |
model_display = gr.Textbox(value="gender", interactive=False)
|