Update app.py
Browse files
app.py
CHANGED
@@ -159,7 +159,7 @@ HTML_TEMPLATE = """
|
|
159 |
|
160 |
# The rest of the Python code remains the same
|
161 |
def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
|
162 |
-
model = yolov9.load('./best.pt')
|
163 |
model.conf = conf_threshold
|
164 |
model.iou = iou_threshold
|
165 |
results = model(img_path, size=image_size)
|
@@ -167,7 +167,7 @@ def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
|
|
167 |
return output[0]
|
168 |
|
169 |
def app():
|
170 |
-
with gr.Blocks() as demo:
|
171 |
gr.HTML(HTML_TEMPLATE)
|
172 |
|
173 |
with gr.Row():
|
@@ -189,8 +189,8 @@ def app():
|
|
189 |
|
190 |
gr.Examples(
|
191 |
examples=[
|
192 |
-
["./openmanhole.jpg", 640, 0.4, 0.5],
|
193 |
-
["./images.jpeg", 640, 0.4, 0.5],
|
194 |
],
|
195 |
fn=yolov9_inference,
|
196 |
inputs=[img_path, image_size, conf_threshold, iou_threshold],
|
@@ -200,16 +200,9 @@ def app():
|
|
200 |
|
201 |
return demo
|
202 |
|
203 |
-
|
204 |
-
/* You can add any additional CSS here to style Gradio components */
|
205 |
-
.gradio-container {
|
206 |
-
max-width: 900px !important;
|
207 |
-
margin-left: auto !important;
|
208 |
-
margin-right: auto !important;
|
209 |
-
}
|
210 |
-
"""
|
211 |
|
212 |
-
demo = gr.Blocks(
|
213 |
|
214 |
with demo:
|
215 |
app()
|
|
|
159 |
|
160 |
# The rest of the Python code remains the same
|
161 |
def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
|
162 |
+
model = yolov9.load('./best.pt') # Load your trained model
|
163 |
model.conf = conf_threshold
|
164 |
model.iou = iou_threshold
|
165 |
results = model(img_path, size=image_size)
|
|
|
167 |
return output[0]
|
168 |
|
169 |
def app():
|
170 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo: # Added a theme here
|
171 |
gr.HTML(HTML_TEMPLATE)
|
172 |
|
173 |
with gr.Row():
|
|
|
189 |
|
190 |
gr.Examples(
|
191 |
examples=[
|
192 |
+
["./openmanhole.jpg", 640, 0.4, 0.5], # Add your example images
|
193 |
+
["./images.jpeg", 640, 0.4, 0.5], # Add your example images
|
194 |
],
|
195 |
fn=yolov9_inference,
|
196 |
inputs=[img_path, image_size, conf_threshold, iou_threshold],
|
|
|
200 |
|
201 |
return demo
|
202 |
|
203 |
+
# Removed the separate CSS variable and added theme to gr.Blocks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
+
demo = gr.Blocks() # Moved the theme application here
|
206 |
|
207 |
with demo:
|
208 |
app()
|