apailang commited on
Commit
20f285d
Β·
1 Parent(s): 6e8b4f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -40,7 +40,8 @@ def load_model(model_repo_id):
40
  def predict(pilimg,Threshold):
41
 
42
  image_np = pil_image_as_numpy_array(pilimg)
43
- return predict2(image_np,float(Threshold)),predict3(image_np,float(Threshold))
 
44
 
45
  def predict2(image_np,Threshold):
46
 
@@ -168,8 +169,8 @@ test12 = os.path.join(os.path.dirname(__file__), "data/test12.jpeg")
168
 
169
  base_image = gr.Interface(
170
  fn=predict,
171
- inputs=[gr.Image(type="pil"),gr.Slider(minimum=0.01, maximum=0.99, value=0.6 ,label="Threshold",info="[not in used]to set prediction confidence threshold")],
172
- outputs=[gr.Image(type="pil",label="Base Model"),gr.Image(type="pil",label="Tuned Model")],
173
  title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",
174
  description="Upload a Image for prediction or click on below examples. Prediction confident >38% will be shown in dectected images. Threshold slider is WIP",
175
  examples=[[test1],[test2],[test3],[test4],[test5],[test6],[test7],[test8],[test9],[test10],[test11],[test12],],
@@ -207,8 +208,8 @@ base_image = gr.Interface(
207
 
208
  video = gr.Interface(
209
  fn=lambda x,y: [x,y], #video_demo,
210
- inputs=[gr.Video(label="base model Video"),gr.Video(label="tuned model Video")],
211
- outputs=[gr.Video(label="Base model inferenced video"), gr.Video(label="Tuned model inferenced video")],
212
  examples=[
213
  [a, b]
214
  ],
 
40
  def predict(pilimg,Threshold):
41
 
42
  image_np = pil_image_as_numpy_array(pilimg)
43
+ Thresholdf=float(Threshold)
44
+ return predict2(image_np,Thresholdf),predict3(image_np,Thresholdf)
45
 
46
  def predict2(image_np,Threshold):
47
 
 
169
 
170
  base_image = gr.Interface(
171
  fn=predict,
172
+ inputs=[gr.Image(type="pil"),gr.Slider(minimum=0.01, maximum=1, value=0.38 ,label="Threshold",info="[not in used]to set prediction confidence threshold")],
173
+ outputs=[gr.Image(type="pil",label="Base Model Inference"),gr.Image(type="pil",label="Tuned Model Inference")],
174
  title="Luffy and Chopper Head detection. SSD mobile net V2 320x320",
175
  description="Upload a Image for prediction or click on below examples. Prediction confident >38% will be shown in dectected images. Threshold slider is WIP",
176
  examples=[[test1],[test2],[test3],[test4],[test5],[test6],[test7],[test8],[test9],[test10],[test11],[test12],],
 
208
 
209
  video = gr.Interface(
210
  fn=lambda x,y: [x,y], #video_demo,
211
+ inputs=[gr.Video(label="Base Model Video",interactive=False),gr.Video(label="Tuned Model Video",interactive=False)],
212
+ outputs=[gr.Video(label="Base Model Inferenced Video"), gr.Video(label="Tuned Model Inferenced Video")],
213
  examples=[
214
  [a, b]
215
  ],