yassonee commited on
Commit
5db7880
·
verified ·
1 Parent(s): ff4daac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -22,9 +22,7 @@ st.markdown("""
22
  }
23
 
24
  .stImage > img {
25
- width: 50% !important;
26
- height: auto !important;
27
- max-height: 120px !important;
28
  object-fit: contain !important;
29
  }
30
 
@@ -88,9 +86,7 @@ def draw_boxes(image, predictions):
88
  )
89
 
90
  # Label plus compact
91
- text_bbox = draw.textbbox((box['xmin'], box['ymin']-15), label)
92
- draw.rectangle(text_bbox, fill=color)
93
- draw.text((box['xmin'], box['ymin']-15), label, fill="white")
94
  return image
95
 
96
  def main():
@@ -106,7 +102,7 @@ def main():
106
  <p>Bitte laden Sie ein Röntgenbild hoch, um die Analyse zu starten.</p>
107
  </div>
108
  """, unsafe_allow_html=True)
109
- uploaded_file = st.file_uploader("", type=['png', 'jpg', 'jpeg'])
110
 
111
  if uploaded_file:
112
  st.session_state["uploaded"] = True
@@ -151,7 +147,7 @@ def main():
151
  """, unsafe_allow_html=True)
152
 
153
  with col2:
154
- st.image(image, use_column_width=True)
155
 
156
  predictions_auge = models["KnochenAuge"](image)
157
  filtered_preds = [p for p in predictions_auge if p['score'] >= 0.6]
@@ -161,7 +157,7 @@ def main():
161
  st.markdown("### 👁️ Das KnochenAuge - Lokalisation")
162
  result_image = image.copy()
163
  result_image = draw_boxes(result_image, filtered_preds)
164
- st.image(result_image, use_column_width=True)
165
 
166
  if __name__ == "__main__":
167
  main()
 
22
  }
23
 
24
  .stImage > img {
25
+ max-height: 150px !important;
 
 
26
  object-fit: contain !important;
27
  }
28
 
 
86
  )
87
 
88
  # Label plus compact
89
+ draw.text((box['xmin'], box['ymin'] - 15), label, fill="white")
 
 
90
  return image
91
 
92
  def main():
 
102
  <p>Bitte laden Sie ein Röntgenbild hoch, um die Analyse zu starten.</p>
103
  </div>
104
  """, unsafe_allow_html=True)
105
+ uploaded_file = st.file_uploader("Röntgenbild auswählen", type=['png', 'jpg', 'jpeg'], label_visibility="collapsed")
106
 
107
  if uploaded_file:
108
  st.session_state["uploaded"] = True
 
147
  """, unsafe_allow_html=True)
148
 
149
  with col2:
150
+ st.image(image, use_container_width=True)
151
 
152
  predictions_auge = models["KnochenAuge"](image)
153
  filtered_preds = [p for p in predictions_auge if p['score'] >= 0.6]
 
157
  st.markdown("### 👁️ Das KnochenAuge - Lokalisation")
158
  result_image = image.copy()
159
  result_image = draw_boxes(result_image, filtered_preds)
160
+ st.image(result_image, use_container_width=True)
161
 
162
  if __name__ == "__main__":
163
  main()