Update app.py
Browse files
app.py
CHANGED
|
@@ -51,7 +51,13 @@ def app():
|
|
| 51 |
)
|
| 52 |
|
| 53 |
return demo
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
<style>
|
| 56 |
body {
|
| 57 |
background: linear-gradient(135deg, #2c3e50, #34495e, #95a5a6);
|
|
@@ -185,6 +191,26 @@ css = """
|
|
| 185 |
</div>
|
| 186 |
</div>
|
| 187 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
}
|
| 189 |
"""
|
| 190 |
|
|
|
|
| 51 |
)
|
| 52 |
|
| 53 |
return demo
|
| 54 |
+
import gradio as gr
|
| 55 |
+
import torch
|
| 56 |
+
from PIL import Image
|
| 57 |
+
import os
|
| 58 |
+
import yolov9
|
| 59 |
+
|
| 60 |
+
HTML_TEMPLATE = """
|
| 61 |
<style>
|
| 62 |
body {
|
| 63 |
background: linear-gradient(135deg, #2c3e50, #34495e, #95a5a6);
|
|
|
|
| 191 |
</div>
|
| 192 |
</div>
|
| 193 |
</div>
|
| 194 |
+
"""
|
| 195 |
+
|
| 196 |
+
# Your existing yolov9_inference function here
|
| 197 |
+
def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
|
| 198 |
+
# ... (your existing code)
|
| 199 |
+
|
| 200 |
+
def app():
|
| 201 |
+
with gr.Blocks() as demo:
|
| 202 |
+
gr.HTML(HTML_TEMPLATE)
|
| 203 |
+
|
| 204 |
+
# ... (rest of your existing app code)
|
| 205 |
+
|
| 206 |
+
return demo
|
| 207 |
+
|
| 208 |
+
css = """
|
| 209 |
+
/* You can add any additional CSS here to style Gradio components */
|
| 210 |
+
.gradio-container {
|
| 211 |
+
max-width: 900px !important;
|
| 212 |
+
margin-left: auto !important;
|
| 213 |
+
margin-right: auto !important;
|
| 214 |
}
|
| 215 |
"""
|
| 216 |
|