il-hoon commited on
Commit
575d105
·
1 Parent(s): 596fcc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -44
app.py CHANGED
@@ -1,47 +1,10 @@
1
- import gradio as gr
2
- import os
3
- import shlex
4
- import uuid
5
- import torch
6
 
7
- cpu_param = "--cpu" if not torch.cuda.is_available() else ""
8
 
9
- def inference(audio_path, text, mic_path=None):
10
- if mic_path:
11
- audio_path = mic_path
12
- output_path = f"/tmp/output_{uuid.uuid4()}.wav"
13
- os.system(
14
- f"python demo_cli.py --no_sound {cpu_param} --audio_path {audio_path} --text {shlex.quote(text.strip())} --output_path {output_path}")
15
- return output_path
16
 
17
-
18
- title = "Real-Time-Korea-Voice-Cloning"
19
- description = "Gradio demo for Real-Time-Korea-Voice-Cloning: Clone a voice in 600 seconds to generate arbitrary speech in real-time. To use it, simply upload your audio, or click one of the examples to load them. Read more at the links below."
20
- article = "<p style='text-align: center'><a href='https://matheo.uliege.be/handle/2268.2/6801' target='_blank'>Real-Time Voice Cloning</a> | <a href='https://github.com/JH-lee95/Korean-Voice-Cloning.git' target='_blank'>Github Repo</a></p>"
21
-
22
- def toggle(choice):
23
- if choice == "mic":
24
- return gr.update(visible=True, value=None), gr.update(visible=False, value=None)
25
- else:
26
- return gr.update(visible=False, value=None), gr.update(visible=True, value=None)
27
-
28
-
29
- with gr.Blocks() as demo:
30
- with gr.Row():
31
- with gr.Column():
32
- radio = gr.Radio(["mic", "file"], value="mic",
33
- label="How would you like to upload your audio?")
34
- mic_input = gr.Mic(label="Input", type="filepath", visible=False)
35
- audio_file = gr.Audio(
36
- type="filepath", label="Input", visible=True)
37
- text_input = gr.Textbox(label="Text")
38
- with gr.Column():
39
- audio_output = gr.Audio(label="Output")
40
-
41
- gr.Examples, fn=inference, inputs=[audio_file, text_input],
42
- btn = gr.Button("Generate")
43
- btn.click(inference, inputs=[audio_file,
44
- text_input, mic_input], outputs=audio_output)
45
- radio.change(toggle, radio, [mic_input, audio_file])
46
-
47
- demo.launch(enable_queue=True)
 
1
+ $git clone https://huggingface.co/spaces/il-hoon/realKtimeKvoice
 
 
 
 
2
 
3
+ import streamlit as st
4
 
5
+ x = st.slider('Select a value')
6
+ st.write(x, 'squared is', x * x)
 
 
 
 
 
7
 
8
+ $git add app.py
9
+ $git commit -m "Add application file"
10
+ $git push