tstone87 commited on
Commit
04e7cfc
·
verified ·
1 Parent(s): a3a11bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -54,7 +54,6 @@ def process_input(uploaded_file, youtube_link, image_url, sensitivity):
54
  return None, None, "Please provide an input using one of the methods.", ""
55
 
56
  try:
57
- # Pass the slider value as the confidence threshold.
58
  results = model.predict(source=input_path, save=True, conf=sensitivity)
59
  except Exception as e:
60
  return None, None, f"Error running prediction: {e}", ""
@@ -84,14 +83,11 @@ with gr.Blocks(css="""
84
  object-fit: contain;
85
  }
86
  """) as demo:
87
- # Header with scaled image (25% width) and title using absolute URL.
88
- gr.HTML("<div style='text-align:center;'><img src='https://huggingface.co/spaces/tstone87/stance-detection/resolve/main/crowdresult.jpg' style='width:25%;'/></div>")
89
- gr.Markdown("## Pose Detection with YOLO11-pose")
90
-
91
- # Create a two-column layout.
92
  with gr.Row():
93
- # Left column: Input tabs and sensitivity slider.
94
  with gr.Column(scale=1):
 
 
95
  with gr.Tabs():
96
  with gr.TabItem("Upload File"):
97
  file_input = gr.File(label="Upload Image/Video")
@@ -99,9 +95,9 @@ with gr.Blocks(css="""
99
  youtube_input = gr.Textbox(label="YouTube Link", placeholder="https://...")
100
  with gr.TabItem("Image URL"):
101
  image_url_input = gr.Textbox(label="Image URL", placeholder="https://...")
102
- sensitivity_slider = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.15,
103
  label="Sensitivity (Confidence Threshold)")
104
- # Right column: Display result.
105
  with gr.Column(scale=2):
106
  output_display = gr.Image(label="Annotated Output", elem_classes="result_img")
107
  output_file = gr.File(label="Download Annotated Output")
 
54
  return None, None, "Please provide an input using one of the methods.", ""
55
 
56
  try:
 
57
  results = model.predict(source=input_path, save=True, conf=sensitivity)
58
  except Exception as e:
59
  return None, None, f"Error running prediction: {e}", ""
 
83
  object-fit: contain;
84
  }
85
  """) as demo:
 
 
 
 
 
86
  with gr.Row():
87
+ # Left Column: Header image, title, input tabs and sensitivity slider.
88
  with gr.Column(scale=1):
89
+ gr.HTML("<div style='text-align:center;'><img src='https://huggingface.co/spaces/tstone87/stance-detection/resolve/main/crowdresult.jpg' style='width:25%;'/></div>")
90
+ gr.Markdown("## Pose Detection with YOLO11-pose")
91
  with gr.Tabs():
92
  with gr.TabItem("Upload File"):
93
  file_input = gr.File(label="Upload Image/Video")
 
95
  youtube_input = gr.Textbox(label="YouTube Link", placeholder="https://...")
96
  with gr.TabItem("Image URL"):
97
  image_url_input = gr.Textbox(label="Image URL", placeholder="https://...")
98
+ sensitivity_slider = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.5,
99
  label="Sensitivity (Confidence Threshold)")
100
+ # Right Column: Results display at the top.
101
  with gr.Column(scale=2):
102
  output_display = gr.Image(label="Annotated Output", elem_classes="result_img")
103
  output_file = gr.File(label="Download Annotated Output")