Update Dockerfile
Browse files- Dockerfile +1 -95
Dockerfile
CHANGED
@@ -1,71 +1,4 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
---
|
5 |
-
|
6 |
-
1. Directory Structure
|
7 |
-
|
8 |
-
openvoice-gradio-app/
|
9 |
-
βββ app.py
|
10 |
-
βββ Dockerfile
|
11 |
-
βββ requirements.txt
|
12 |
-
βββ README.md (optional)
|
13 |
-
|
14 |
-
|
15 |
-
---
|
16 |
-
|
17 |
-
2. app.py
|
18 |
-
|
19 |
-
Here's a minimal Gradio interface using OpenVoice:
|
20 |
-
|
21 |
-
import gradio as gr
|
22 |
-
from openvoice import OpenVoice
|
23 |
-
|
24 |
-
# Load OpenVoice model (adjust to your setup)
|
25 |
-
model = OpenVoice(language="en")
|
26 |
-
|
27 |
-
def clone_and_speak(audio, text):
|
28 |
-
output_path = "output.wav"
|
29 |
-
model.clone_voice(
|
30 |
-
source_audio_path=audio.name,
|
31 |
-
target_text=text,
|
32 |
-
output_path=output_path
|
33 |
-
)
|
34 |
-
return output_path
|
35 |
-
|
36 |
-
with gr.Blocks() as demo:
|
37 |
-
gr.Markdown("# OpenVoice TTS - Hugging Face Space")
|
38 |
-
with gr.Row():
|
39 |
-
audio_input = gr.Audio(label="Upload voice to clone", type="file")
|
40 |
-
text_input = gr.Textbox(label="Enter text to synthesize")
|
41 |
-
with gr.Row():
|
42 |
-
generate_btn = gr.Button("Generate Audio")
|
43 |
-
audio_output = gr.Audio(label="Synthesized Output", type="filepath")
|
44 |
-
|
45 |
-
generate_btn.click(fn=clone_and_speak, inputs=[audio_input, text_input], outputs=audio_output)
|
46 |
-
|
47 |
-
demo.launch()
|
48 |
-
|
49 |
-
|
50 |
-
---
|
51 |
-
|
52 |
-
3. requirements.txt
|
53 |
-
|
54 |
-
List all necessary dependencies:
|
55 |
-
|
56 |
-
gradio
|
57 |
-
torch
|
58 |
-
transformers
|
59 |
-
numpy
|
60 |
-
# Include the repo name if OpenVoice is pip-installable
|
61 |
-
# If using local installation, skip and use Dockerfile instead
|
62 |
-
|
63 |
-
|
64 |
-
---
|
65 |
-
|
66 |
-
4. Dockerfile
|
67 |
-
|
68 |
-
# Use official Python image
|
69 |
FROM python:3.10-slim
|
70 |
|
71 |
# System dependencies
|
@@ -90,30 +23,3 @@ EXPOSE 7860
|
|
90 |
|
91 |
# Launch the app
|
92 |
CMD ["python", "app.py"]
|
93 |
-
|
94 |
-
|
95 |
-
---
|
96 |
-
|
97 |
-
5. Push to Hugging Face Spaces
|
98 |
-
|
99 |
-
1. Create a new Space on Hugging Face.
|
100 |
-
|
101 |
-
|
102 |
-
2. Set SDK to Docker.
|
103 |
-
|
104 |
-
|
105 |
-
3. Push your files to the linked repo via Git.
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
git init
|
110 |
-
git remote add origin https://huggingface.co/spaces/your-username/openvoice-gradio-app
|
111 |
-
git add .
|
112 |
-
git commit -m "Initial commit"
|
113 |
-
git push -u origin main
|
114 |
-
|
115 |
-
|
116 |
-
---
|
117 |
-
|
118 |
-
Let me know if OpenVoice needs special model download steps or GPU setup. I can adjust the Dockerfile accordingly. Would you like GPU support included?
|
119 |
-
|
|
|
1 |
+
#Use official Python image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
# System dependencies
|
|
|
23 |
|
24 |
# Launch the app
|
25 |
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|