Nunzio commited on
Commit
c07b4af
·
1 Parent(s): 2eadc64

momentarly disabled error correction codes

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -29,13 +29,13 @@ def run_prediction(image: gr.Image, selected_model: str)-> tuple[torch.Tensor]:
29
 
30
  if selected_model is None:
31
  return (gr.update(value=None, visible=False), gr.update(value=f"❌ No model selected for prediction.", visible=True))
32
- try:
33
- model = loadModel(selected_model, device)
34
- image = hfImageToTensor(image, width=1024, height=512)
35
- prediction = predict(image, model)
36
- prediction = postprocessing(prediction)
37
- except Exception as e:
38
- return (gr.update(value=None, visible=False), gr.update(value=f"❌ {str(e)}.", visible=True))
39
  return (gr.update(value=prediction, visible=True), gr.update(value="", visible=False))
40
 
41
  # Gradio UI
 
29
 
30
  if selected_model is None:
31
  return (gr.update(value=None, visible=False), gr.update(value=f"❌ No model selected for prediction.", visible=True))
32
+ # try:
33
+ model = loadModel(selected_model, device)
34
+ image = hfImageToTensor(image, width=1024, height=512)
35
+ prediction = predict(image, model)
36
+ prediction = postprocessing(prediction)
37
+ # except Exception as e:
38
+ # return (gr.update(value=None, visible=False), gr.update(value=f"❌ {str(e)}.", visible=True))
39
  return (gr.update(value=prediction, visible=True), gr.update(value="", visible=False))
40
 
41
  # Gradio UI