Spaces:
Sleeping
Sleeping
krishnapal2308
commited on
Commit
•
599f168
1
Parent(s):
0d65c8f
Add Description
Browse files- app.py +20 -5
- gradio_cached_examples/17/log.csv +5 -0
- gradio_cached_examples/17/output 1/5f5ac48c51830807ebc1/audio +0 -0
- gradio_cached_examples/17/output 1/616c31df069fc6f8ff8d/audio +0 -0
- gradio_cached_examples/17/output 1/a7b3fb069783e183f30e/audio +0 -0
- gradio_cached_examples/17/output 1/ca5aaabdfeef6bfd1a0b/audio +0 -0
app.py
CHANGED
@@ -8,12 +8,28 @@ import warnings
|
|
8 |
|
9 |
warnings.filterwarnings('ignore')
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
def process_image_and_generate_output(image, model_selection):
|
13 |
if image is None:
|
14 |
return "Please select an image", None
|
15 |
-
# (Trained only for 15 epochs without any hyperparameter tuning, utilizing inception v3)'
|
16 |
-
# (SOTA model for Image captioning)
|
17 |
if model_selection == 'Basic Model':
|
18 |
result = inference_script.evaluate(image)
|
19 |
pred_caption = ' '.join(result).rsplit(' ', 1)[0]
|
@@ -46,7 +62,6 @@ sample_images = [
|
|
46 |
[os.path.join(os.path.dirname(__file__), "sample_images/3.jpg"), 'Basic Model']
|
47 |
]
|
48 |
|
49 |
-
|
50 |
# Create a dropdown to select sample image
|
51 |
image_input = gr.Image(label="Upload Image")
|
52 |
|
@@ -61,7 +76,7 @@ iface = gr.Interface(fn=process_image_and_generate_output,
|
|
61 |
examples=sample_images,
|
62 |
cache_examples=True,
|
63 |
allow_flagging='never',
|
64 |
-
title="Eye For Blind | Image Captioning & TTS",
|
65 |
-
description="
|
66 |
|
67 |
iface.launch()
|
|
|
8 |
|
9 |
warnings.filterwarnings('ignore')
|
10 |
|
11 |
+
# Define problem statement
|
12 |
+
problem_statement = """
|
13 |
+
### Problem Statement
|
14 |
+
Visually impaired individuals face challenges in understanding image content. This project aims to address this issue by generating descriptive spoken captions for images, leveraging CNNs and RNNs for feature extraction and sequence generation, respectively. The model is trained on the Flickr8K dataset and extended with an attention mechanism for enhanced accessibility.
|
15 |
+
"""
|
16 |
+
|
17 |
+
# Define solution overview
|
18 |
+
solution_overview = """
|
19 |
+
### Solution Overview
|
20 |
+
The basic model, trained for a limited duration without extensive hyperparameter tuning, primarily focuses on exploring subclassing techniques. To improve inference quality, Vit-GPT2 architecture is integrated. [Visit the Kaggle notebook](https://www.kaggle.com/code/krishna2308/eye-for-blind) for implementation details.
|
21 |
+
"""
|
22 |
+
|
23 |
+
# Define real-life scenario application
|
24 |
+
real_life_scenario = """
|
25 |
+
### Real-life Scenario Application
|
26 |
+
While this current implementation may not support real-time processing, the potential for future development is vast. Where a visually impaired individual wears smart glasses equipped with a camera. As they move around, the camera captures live footage of their surroundings, which is then processed in real-time by the image captioning model integrated into the glasses. The generated spoken descriptions can be streamed directly to the user's earpiece, providing instant audio feedback about their environment.
|
27 |
+
"""
|
28 |
+
|
29 |
|
30 |
def process_image_and_generate_output(image, model_selection):
|
31 |
if image is None:
|
32 |
return "Please select an image", None
|
|
|
|
|
33 |
if model_selection == 'Basic Model':
|
34 |
result = inference_script.evaluate(image)
|
35 |
pred_caption = ' '.join(result).rsplit(' ', 1)[0]
|
|
|
62 |
[os.path.join(os.path.dirname(__file__), "sample_images/3.jpg"), 'Basic Model']
|
63 |
]
|
64 |
|
|
|
65 |
# Create a dropdown to select sample image
|
66 |
image_input = gr.Image(label="Upload Image")
|
67 |
|
|
|
76 |
examples=sample_images,
|
77 |
cache_examples=True,
|
78 |
allow_flagging='never',
|
79 |
+
title="Eye For Blind | Image Captioning & TTS Demo",
|
80 |
+
description=f"{problem_statement}\n\n{solution_overview}\n\n{real_life_scenario}")
|
81 |
|
82 |
iface.launch()
|
gradio_cached_examples/17/log.csv
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
output 0,output 1,flag,username,timestamp
|
2 |
+
people sitting on top of a snow covered slope,"{""path"":""gradio_cached_examples\\17\\output 1\\ca5aaabdfeef6bfd1a0b\\audio"",""url"":null,""size"":null,""orig_name"":""audio"",""mime_type"":null}",,,2024-02-09 15:43:56.019598
|
3 |
+
five children getting ready to sled,"{""path"":""gradio_cached_examples\\17\\output 1\\616c31df069fc6f8ff8d\\audio"",""url"":null,""size"":null,""orig_name"":""audio"",""mime_type"":null}",,,2024-02-09 15:43:57.007513
|
4 |
+
a man riding a bike down a mountain side,"{""path"":""gradio_cached_examples\\17\\output 1\\a7b3fb069783e183f30e\\audio"",""url"":null,""size"":null,""orig_name"":""audio"",""mime_type"":null}",,,2024-02-09 15:43:58.457672
|
5 |
+
a man on a bicycle on a mountain,"{""path"":""gradio_cached_examples\\17\\output 1\\5f5ac48c51830807ebc1\\audio"",""url"":null,""size"":null,""orig_name"":""audio"",""mime_type"":null}",,,2024-02-09 15:43:59.021601
|
gradio_cached_examples/17/output 1/5f5ac48c51830807ebc1/audio
ADDED
Binary file (11.2 kB). View file
|
|
gradio_cached_examples/17/output 1/616c31df069fc6f8ff8d/audio
ADDED
Binary file (11 kB). View file
|
|
gradio_cached_examples/17/output 1/a7b3fb069783e183f30e/audio
ADDED
Binary file (13 kB). View file
|
|
gradio_cached_examples/17/output 1/ca5aaabdfeef6bfd1a0b/audio
ADDED
Binary file (13.2 kB). View file
|
|