Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from gender_classification import gender_classification
|
|
3 |
from emotion_classification import emotion_classification
|
4 |
from dog_breed import dog_breed_classification
|
5 |
from deepfake_vs_real import deepfake_classification
|
|
|
6 |
|
7 |
# Functions to update the model state when a button is clicked.
|
8 |
def select_gender():
|
@@ -17,6 +18,9 @@ def select_dog_breed():
|
|
17 |
def select_deepfake():
|
18 |
return "deepfake"
|
19 |
|
|
|
|
|
|
|
20 |
# Main classification function that calls the appropriate model based on selection.
|
21 |
def classify(image, model_name):
|
22 |
if model_name == "gender":
|
@@ -27,6 +31,8 @@ def classify(image, model_name):
|
|
27 |
return dog_breed_classification(image)
|
28 |
elif model_name == "deepfake":
|
29 |
return deepfake_classification(image)
|
|
|
|
|
30 |
else:
|
31 |
return {"Error": "No model selected"}
|
32 |
|
@@ -39,6 +45,7 @@ with gr.Blocks() as demo:
|
|
39 |
emotion_btn = gr.Button("Emotion Classification")
|
40 |
dog_breed_btn = gr.Button("Dog Breed Classification")
|
41 |
deepfake_btn = gr.Button("Deepfake vs Real")
|
|
|
42 |
|
43 |
# State to hold the current model choice.
|
44 |
selected_model = gr.State("gender")
|
@@ -48,6 +55,7 @@ with gr.Blocks() as demo:
|
|
48 |
emotion_btn.click(fn=select_emotion, inputs=[], outputs=selected_model)
|
49 |
dog_breed_btn.click(fn=select_dog_breed, inputs=[], outputs=selected_model)
|
50 |
deepfake_btn.click(fn=select_deepfake, inputs=[], outputs=selected_model)
|
|
|
51 |
|
52 |
gr.Markdown("### Current Model:")
|
53 |
model_display = gr.Textbox(value="gender", interactive=False)
|
|
|
3 |
from emotion_classification import emotion_classification
|
4 |
from dog_breed import dog_breed_classification
|
5 |
from deepfake_vs_real import deepfake_classification
|
6 |
+
from gym_workout_classification import gym_workout_classification
|
7 |
|
8 |
# Functions to update the model state when a button is clicked.
|
9 |
def select_gender():
|
|
|
18 |
def select_deepfake():
|
19 |
return "deepfake"
|
20 |
|
21 |
+
def select_gym_workout():
|
22 |
+
return "gym workout"
|
23 |
+
|
24 |
# Main classification function that calls the appropriate model based on selection.
|
25 |
def classify(image, model_name):
|
26 |
if model_name == "gender":
|
|
|
31 |
return dog_breed_classification(image)
|
32 |
elif model_name == "deepfake":
|
33 |
return deepfake_classification(image)
|
34 |
+
elif model_name == "gym workout":
|
35 |
+
return gym_workout_classification(image)
|
36 |
else:
|
37 |
return {"Error": "No model selected"}
|
38 |
|
|
|
45 |
emotion_btn = gr.Button("Emotion Classification")
|
46 |
dog_breed_btn = gr.Button("Dog Breed Classification")
|
47 |
deepfake_btn = gr.Button("Deepfake vs Real")
|
48 |
+
gym_workout_btn = gr.Button("Gym Workout Classification")
|
49 |
|
50 |
# State to hold the current model choice.
|
51 |
selected_model = gr.State("gender")
|
|
|
55 |
emotion_btn.click(fn=select_emotion, inputs=[], outputs=selected_model)
|
56 |
dog_breed_btn.click(fn=select_dog_breed, inputs=[], outputs=selected_model)
|
57 |
deepfake_btn.click(fn=select_deepfake, inputs=[], outputs=selected_model)
|
58 |
+
gym_workout_btn.click(fn=select_gym_workout, inputs=[], outputs=selected_model)
|
59 |
|
60 |
gr.Markdown("### Current Model:")
|
61 |
model_display = gr.Textbox(value="gender", interactive=False)
|