Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,57 +65,79 @@ def get_audioldm_from_caption(caption):
|
|
| 65 |
return None
|
| 66 |
|
| 67 |
css = """
|
| 68 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
margin: 0 auto;
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
"""
|
| 73 |
|
| 74 |
with gr.Blocks(css=css) as demo:
|
| 75 |
-
with gr.Column(elem_id="
|
| 76 |
gr.HTML("""
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
⚡ Powered by <a href="https://bilsimaging.com" target="_blank">Bilsimaging</a>
|
| 80 |
-
</p>
|
| 81 |
""")
|
| 82 |
|
| 83 |
-
gr.
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
[contact@bilsimaging.com](mailto:contact@bilsimaging.com).
|
| 109 |
-
|
| 110 |
-
Support our work and get involved by donating through
|
| 111 |
-
[Ko-fi](https://ko-fi.com/bilsimaging). - Bilel Aroua
|
| 112 |
-
""")
|
| 113 |
-
|
| 114 |
-
gr.Markdown("""
|
| 115 |
-
## 📢 Stay Connected
|
| 116 |
-
This app is a testament to the creative possibilities that emerge when technology meets art.
|
| 117 |
-
Enjoy exploring the auditory landscape of your images!
|
| 118 |
-
""")
|
| 119 |
|
| 120 |
def update_caption(image_file):
|
| 121 |
description, _ = analyze_image_with_free_model(image_file)
|
|
|
|
| 65 |
return None
|
| 66 |
|
| 67 |
css = """
|
| 68 |
+
#header-container {
|
| 69 |
+
text-align: center;
|
| 70 |
+
margin: 20px 0;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
#header-title {
|
| 74 |
+
font-size: 36px;
|
| 75 |
+
font-weight: bold;
|
| 76 |
+
margin-bottom: 10px;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
#header-subtitle {
|
| 80 |
+
font-size: 18px;
|
| 81 |
+
margin-bottom: 20px;
|
| 82 |
+
color: #6c757d;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
#main-container {
|
| 86 |
+
max-width: 900px;
|
| 87 |
margin: 0 auto;
|
| 88 |
+
padding: 20px;
|
| 89 |
+
border-radius: 12px;
|
| 90 |
+
background-color: #f9f9f9;
|
| 91 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
button.primary-button {
|
| 95 |
+
background-color: #007bff;
|
| 96 |
+
color: white;
|
| 97 |
+
border: none;
|
| 98 |
+
padding: 10px 20px;
|
| 99 |
+
border-radius: 5px;
|
| 100 |
+
font-size: 16px;
|
| 101 |
+
cursor: pointer;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
button.primary-button:hover {
|
| 105 |
+
background-color: #0056b3;
|
| 106 |
+
}
|
| 107 |
"""
|
| 108 |
|
| 109 |
with gr.Blocks(css=css) as demo:
|
| 110 |
+
with gr.Column(elem_id="header-container"):
|
| 111 |
gr.HTML("""
|
| 112 |
+
<div id="header-title">🎶 Image-to-Sound Generator</div>
|
| 113 |
+
<div id="header-subtitle">Transform your images into descriptive captions and immersive soundscapes.</div>
|
|
|
|
|
|
|
| 114 |
""")
|
| 115 |
|
| 116 |
+
with gr.Box(elem_id="main-container"):
|
| 117 |
+
gr.Markdown("""
|
| 118 |
+
### How It Works
|
| 119 |
+
1. **Upload an Image**: Select an image to analyze.
|
| 120 |
+
2. **Generate Description**: Get a detailed caption describing your image.
|
| 121 |
+
3. **Generate Sound**: Create an audio representation based on the caption.
|
| 122 |
+
""")
|
| 123 |
+
|
| 124 |
+
image_upload = gr.File(label="Upload Image", type="binary")
|
| 125 |
+
generate_description_button = gr.Button("Generate Description", elem_classes="primary-button")
|
| 126 |
+
caption_display = gr.Textbox(label="Generated Caption", interactive=False, placeholder="Your image caption will appear here.")
|
| 127 |
+
generate_sound_button = gr.Button("Generate Sound", elem_classes="primary-button")
|
| 128 |
+
audio_output = gr.Audio(label="Generated Sound Effect", interactive=False)
|
| 129 |
+
|
| 130 |
+
with gr.Box():
|
| 131 |
+
gr.Markdown("""
|
| 132 |
+
## About This App
|
| 133 |
+
This application uses advanced machine learning models to transform images into text captions and generate matching sound effects. It's a unique blend of visual and auditory creativity, powered by state-of-the-art AI technology.
|
| 134 |
+
|
| 135 |
+
### Powered By
|
| 136 |
+
- [Hugging Face](https://huggingface.co)
|
| 137 |
+
- [Diffusion Models](https://huggingface.co/models)
|
| 138 |
+
|
| 139 |
+
For inquiries, contact us at [contact@bilsimaging.com](mailto:contact@bilsimaging.com).
|
| 140 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
def update_caption(image_file):
|
| 143 |
description, _ = analyze_image_with_free_model(image_file)
|