Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,90 +64,43 @@ def get_audioldm_from_caption(caption):
|
|
| 64 |
print(f"Error generating audio from caption: {e}")
|
| 65 |
return None
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
color: white;
|
| 98 |
-
border: none;
|
| 99 |
-
padding: 12px 24px;
|
| 100 |
-
border-radius: 8px;
|
| 101 |
-
font-size: 16px;
|
| 102 |
-
cursor: pointer;
|
| 103 |
-
font-weight: bold;
|
| 104 |
-
transition: transform 0.2s, box-shadow 0.2s;
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
button.primary-button:hover {
|
| 108 |
-
transform: translateY(-3px);
|
| 109 |
-
box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
|
| 110 |
-
}
|
| 111 |
-
|
| 112 |
-
button.primary-button:active {
|
| 113 |
-
transform: translateY(0);
|
| 114 |
-
box-shadow: none;
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
#footer-container {
|
| 118 |
-
margin-top: 30px;
|
| 119 |
-
text-align: center;
|
| 120 |
-
color: #666666;
|
| 121 |
-
font-size: 14px;
|
| 122 |
-
}
|
| 123 |
-
"""
|
| 124 |
-
|
| 125 |
-
with gr.Blocks(css=css) as demo:
|
| 126 |
-
with gr.Column(elem_id="header-container"):
|
| 127 |
-
gr.HTML("""
|
| 128 |
-
<div id="header-title">🎶 Image-to-Sound Generator</div>
|
| 129 |
-
<div id="header-subtitle">Transform your images into descriptive captions and immersive soundscapes.</div>
|
| 130 |
-
""")
|
| 131 |
-
|
| 132 |
-
with gr.Box(elem_id="main-container"):
|
| 133 |
-
gr.Markdown("""
|
| 134 |
-
### How It Works
|
| 135 |
-
1. **Upload an Image**: Select an image to analyze.
|
| 136 |
-
2. **Generate Description**: Get a detailed caption describing your image.
|
| 137 |
-
3. **Generate Sound**: Create an audio representation based on the caption.
|
| 138 |
-
""")
|
| 139 |
-
|
| 140 |
-
image_upload = gr.File(label="Upload Image", type="binary")
|
| 141 |
-
generate_description_button = gr.Button("Generate Description", elem_classes="primary-button")
|
| 142 |
-
caption_display = gr.Textbox(label="Generated Caption", interactive=False, placeholder="Your image caption will appear here.")
|
| 143 |
-
generate_sound_button = gr.Button("Generate Sound", elem_classes="primary-button")
|
| 144 |
-
audio_output = gr.Audio(label="Generated Sound Effect", interactive=False)
|
| 145 |
-
|
| 146 |
-
with gr.Box(elem_id="footer-container"):
|
| 147 |
gr.Markdown("""
|
| 148 |
## About This App
|
| 149 |
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.
|
| 150 |
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
For inquiries, contact us at [contact@bilsimaging.com](mailto:contact@bilsimaging.com).
|
| 153 |
""")
|
|
|
|
| 64 |
print(f"Error generating audio from caption: {e}")
|
| 65 |
return None
|
| 66 |
|
| 67 |
+
with gr.Blocks() as demo:
|
| 68 |
+
with gr.Row():
|
| 69 |
+
with gr.Column(scale=1):
|
| 70 |
+
gr.Image(value="https://via.placeholder.com/150", interactive=False, label="App Logo", elem_id="app-logo")
|
| 71 |
+
with gr.Column(scale=5):
|
| 72 |
+
gr.HTML("""
|
| 73 |
+
<div style="text-align: center; font-size: 32px; font-weight: bold; margin-bottom: 10px;">🎶 Image-to-Sound Generator</div>
|
| 74 |
+
<div style="text-align: center; font-size: 16px; color: #6c757d;">Transform your images into descriptive captions and immersive soundscapes.</div>
|
| 75 |
+
""")
|
| 76 |
+
|
| 77 |
+
with gr.Row():
|
| 78 |
+
with gr.Column():
|
| 79 |
+
gr.Markdown("""
|
| 80 |
+
### How It Works
|
| 81 |
+
1. **Upload an Image**: Select an image to analyze.
|
| 82 |
+
2. **Generate Description**: Get a detailed caption describing your image.
|
| 83 |
+
3. **Generate Sound**: Create an audio representation based on the caption.
|
| 84 |
+
""")
|
| 85 |
+
|
| 86 |
+
with gr.Row():
|
| 87 |
+
with gr.Column(scale=1):
|
| 88 |
+
image_upload = gr.File(label="Upload Image", type="binary")
|
| 89 |
+
generate_description_button = gr.Button("Generate Description", variant="primary")
|
| 90 |
+
with gr.Column(scale=2):
|
| 91 |
+
caption_display = gr.Textbox(label="Generated Caption", interactive=False, placeholder="Your image caption will appear here.")
|
| 92 |
+
generate_sound_button = gr.Button("Generate Sound", variant="primary")
|
| 93 |
+
with gr.Column(scale=1):
|
| 94 |
+
audio_output = gr.Audio(label="Generated Sound Effect", interactive=False)
|
| 95 |
+
|
| 96 |
+
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
gr.Markdown("""
|
| 98 |
## About This App
|
| 99 |
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.
|
| 100 |
|
| 101 |
+
### Powered By
|
| 102 |
+
- [Hugging Face](https://huggingface.co)
|
| 103 |
+
- [Diffusion Models](https://huggingface.co/models)
|
| 104 |
|
| 105 |
For inquiries, contact us at [contact@bilsimaging.com](mailto:contact@bilsimaging.com).
|
| 106 |
""")
|