DanielIglesias97 commited on
Commit
f37ac06
·
1 Parent(s): 92185e8

First upload to the repo.

Browse files
Files changed (3) hide show
  1. Dockerfile +13 -0
  2. main.py +20 -0
  3. requirements.txt +3 -0
Dockerfile ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12
2
+
3
+ RUN apt-get update
4
+ RUN apt-get install -y portaudio19-dev
5
+ RUN apt-get install -y python3-pyaudio
6
+
7
+ WORKDIR /home/user/app
8
+
9
+ COPY ./requirements.txt ./requirements.txt
10
+
11
+ RUN pip3 install -r requirements.txt
12
+
13
+ CMD ["python", "main.py"]
main.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import speech_recognition as sr
3
+
4
+ def transcribe(filename):
5
+ r = sr.Recognizer()
6
+
7
+ with sr.AudioFile(filename) as source:
8
+ # listen for the data (load audio to memory)
9
+ audio_data = r.record(source)
10
+ # recognize (convert from speech to text)
11
+ text = r.recognize_google(audio_data)
12
+
13
+ return text
14
+
15
+ demo = gr.Interface(
16
+ transcribe,
17
+ [gr.Audio(type="filepath")],
18
+ "textbox",
19
+ )
20
+ demo.launch(server_name="0.0.0.0", server_port=7860)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==5.23.3
2
+ PyAudio==0.2.14
3
+ SpeechRecognition==3.14.2