File size: 1,034 Bytes
7718032
 
 
 
 
 
 
 
 
 
 
 
028779a
7718032
 
 
 
 
028779a
7718032
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gradio as gr

lpmc_client = gr.load("seungheondoh/LP-Music-Caps-demo", src="spaces")
from gradio_client import Client

client = Client("https://ysharma-explore-llamav2-with-tgi.hf.space/")


def infer(audio_file):
    
    cap_result = lpmc_client(
    				audio_file,	# str (filepath or URL to file) in 'audio_path' Audio component
    				api_name="/predict"
    )
    print(cap_result)

    result = client.predict(
    				cap_result,	# str in 'Message' Textbox component
    				api_name="/chat"
    )
    
    print(result)
    
    return cap_result, result

with gr.Blocks() as demo:
    with gr.Column(elem_id="col-container"):
        audio_input = gr.Audio(type="filepath", source="upload")
        infer_btn = gr.Button("Generate")
        lpmc_cap = gr.Textbox(label="Lp Music Caps caption")
        llama_trans_cap = gr.Textbox(label="Llama translation")
        img_result = gr.Video(label="Result")

    infer_btn.click(fn=infer, inputs=[audio_input], outputs=[lpmc_cap, llama_trans_cap])

demo.queue().launch()