Update app.py
Browse files
app.py
CHANGED
|
@@ -28,6 +28,18 @@ def predict_image(img):
|
|
| 28 |
sample_images_dir = "samples"
|
| 29 |
sample_images = [os.path.join(sample_images_dir, f) for f in os.listdir(sample_images_dir) if f.endswith(('.jpg', '.png'))]
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Define Gradio Interface
|
| 32 |
interface = gr.Interface(
|
| 33 |
fn=predict_image,
|
|
@@ -36,23 +48,17 @@ interface = gr.Interface(
|
|
| 36 |
examples=sample_images, # Preloaded images for testing
|
| 37 |
title="Bone Fracture Detection",
|
| 38 |
description="Upload an X-ray image or select a sample image to check for fractures.",
|
| 39 |
-
article="""
|
| 40 |
## Instructions
|
| 41 |
-
-
|
| 42 |
-
-
|
| 43 |
-
-
|
| 44 |
-
|
| 45 |
-
- The model can analyze images and transcribe audio
|
| 46 |
-
- For best results with images, use JPG or PNG files
|
| 47 |
-
- For audio, use WAV, MP3, or FLAC files
|
| 48 |
-
|
| 49 |
## Capabilities
|
| 50 |
-
|
| 51 |
-
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
- Process multiple inputs in the same message
|
| 55 |
-
- Maintain context throughout the conversation
|
| 56 |
"""
|
| 57 |
)
|
| 58 |
|
|
|
|
| 28 |
sample_images_dir = "samples"
|
| 29 |
sample_images = [os.path.join(sample_images_dir, f) for f in os.listdir(sample_images_dir) if f.endswith(('.jpg', '.png'))]
|
| 30 |
|
| 31 |
+
# File download paths
|
| 32 |
+
report_path = "report.pdf"
|
| 33 |
+
notebook_path = "bfd.ipynb"
|
| 34 |
+
|
| 35 |
+
# Function to provide file download links
|
| 36 |
+
def get_download_links():
|
| 37 |
+
return f"""
|
| 38 |
+
**Download Project Files:**
|
| 39 |
+
- [Download Report (PDF)]({report_path})
|
| 40 |
+
- [Download Notebook (IPYNB)]({notebook_path})
|
| 41 |
+
"""
|
| 42 |
+
|
| 43 |
# Define Gradio Interface
|
| 44 |
interface = gr.Interface(
|
| 45 |
fn=predict_image,
|
|
|
|
| 48 |
examples=sample_images, # Preloaded images for testing
|
| 49 |
title="Bone Fracture Detection",
|
| 50 |
description="Upload an X-ray image or select a sample image to check for fractures.",
|
| 51 |
+
article=f"""
|
| 52 |
## Instructions
|
| 53 |
+
- Upload an X-ray image to check for fractures.
|
| 54 |
+
- Select a sample image for quick testing.
|
| 55 |
+
- The model will predict if the bone is fractured or normal.
|
| 56 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
## Capabilities
|
| 58 |
+
- Detects bone fractures from X-ray images.
|
| 59 |
+
- Uses a trained deep learning model for classification.
|
| 60 |
+
|
| 61 |
+
{get_download_links()}
|
|
|
|
|
|
|
| 62 |
"""
|
| 63 |
)
|
| 64 |
|