Spaces:
Sleeping
Sleeping
arxivgpt kim
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -136,31 +136,26 @@ css="""
|
|
| 136 |
}
|
| 137 |
"""
|
| 138 |
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
""")
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
image_in = gr.Image(sources=["upload"], type="filepath", label="Image input", value="https://huggingface.co/spaces/arxivgpt/Image2Audio/blob/main/dog.jpg")
|
| 153 |
-
with gr.Row():
|
| 154 |
-
chosen_model = gr.Radio(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen"], value="AudioLDM-2")
|
| 155 |
-
submit_btn = gr.Button("Submit")
|
| 156 |
-
with gr.Column():
|
| 157 |
-
# 오디오 출력 컴포넌트 (예제 오디오 파일 경로 추가는 선택적)
|
| 158 |
-
audio_o = gr.Audio(label="Audio output", value="https://huggingface.co/spaces/arxivgpt/Image2Audio/blob/main/dog.wav")
|
| 159 |
-
|
| 160 |
submit_btn.click(
|
| 161 |
fn=infer,
|
| 162 |
inputs=[image_in, chosen_model],
|
| 163 |
-
outputs=
|
| 164 |
)
|
| 165 |
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
"""
|
| 138 |
|
| 139 |
+
image_examples = [
|
| 140 |
+
["./dog.jpg"],
|
| 141 |
+
["./bird.jpg"]
|
| 142 |
+
]
|
| 143 |
+
|
| 144 |
+
with gr.Blocks() as demo:
|
| 145 |
+
with gr.Column():
|
| 146 |
+
gr.Markdown("### Image to SFX\nCompare MAGNet, AudioLDM2, and AudioGen sound effects generation from image caption.")
|
| 147 |
+
image_in = gr.Image(label="Upload Image", type="filepath")
|
| 148 |
+
chosen_model = gr.Radio(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen"], value="AudioLDM-2")
|
| 149 |
+
submit_btn = gr.Button("Generate Sound Effect")
|
| 150 |
+
audio_o = gr.Audio(label="Audio Output")
|
| 151 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
submit_btn.click(
|
| 153 |
fn=infer,
|
| 154 |
inputs=[image_in, chosen_model],
|
| 155 |
+
outputs=audio_o
|
| 156 |
)
|
| 157 |
|
| 158 |
+
# examples 파라미터에 이미지 예제 경로 추가
|
| 159 |
+
demo.add_examples(examples=image_examples)
|
| 160 |
+
|
| 161 |
+
demo.launch()
|