william commited on
Commit
cb9f2ae
·
1 Parent(s): f98f054
Files changed (5) hide show
  1. .DS_Store +0 -0
  2. .gitignore +2 -0
  3. app.py +38 -0
  4. packages.txt +1 -0
  5. requirements.txt +76 -0
.DS_Store ADDED
Binary file (6.15 kB). View file
 
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ /whisperenv
2
+ *.wav
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ # os.system('sudo apt-get update')
3
+ # os.system('sudo apt-get install ffmpeg -y')
4
+ # os.environ['FFMPEG_BINARY'] = '/usr/bin/ffmpeg'
5
+
6
+ import whisper
7
+ import gradio as gr
8
+ import requests
9
+
10
+ def save_file(file):
11
+ with open(file.name, "wb") as f:
12
+ f.write(file.getbuffer())
13
+ return file.name
14
+
15
+ def summarize_audio(file, email):
16
+ if file and email:
17
+ with gr.spinner("Generating magic..."):
18
+ file_path = save_file(file)
19
+ model = whisper.load_model("base")
20
+ result = model.transcribe(file_path, fp16=False)
21
+ webhook_url = "https://hooks.zapier.com/hooks/catch/14830394/331xres/"
22
+ payload = {"email": email, "result": result["text"]}
23
+ requests.post(webhook_url, json=payload)
24
+ os.remove(file_path)
25
+ return "Done!"
26
+ elif not file:
27
+ return "Please upload your file first!"
28
+ else:
29
+ return "Please enter your email first!"
30
+
31
+ iface = gr.Interface(fn=summarize_audio,
32
+ inputs=[gr.inputs.File(label="Upload your audio file (.wav)") ,
33
+ gr.inputs.Textbox(label="Enter your Email")],
34
+ outputs="text",
35
+ title="Transcript summarizer 🔮",
36
+ description="Upload your audio file and we will summarize it for you!")
37
+
38
+ iface.launch()
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ ffmpeg
requirements.txt ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.1.0
2
+ aiohttp==3.8.4
3
+ aiosignal==1.3.1
4
+ altair==4.2.2
5
+ anyio==3.6.2
6
+ async-timeout==4.0.2
7
+ attrs==22.2.0
8
+ certifi
9
+ charset-normalizer==3.1.0
10
+ click==8.1.3
11
+ contourpy==1.0.7
12
+ cycler==0.11.0
13
+ entrypoints==0.4
14
+ fastapi==0.95.0
15
+ ffmpeg-python==0.2.0
16
+ ffmpy==0.3.0
17
+ filelock==3.10.7
18
+ fonttools==4.39.2
19
+ frozenlist==1.3.3
20
+ fsspec==2023.3.0
21
+ future==0.18.3
22
+ gradio==3.23.0
23
+ h11==0.14.0
24
+ httpcore==0.16.3
25
+ httpx==0.23.3
26
+ huggingface-hub==0.13.3
27
+ idna==3.4
28
+ importlib-resources==5.12.0
29
+ Jinja2==3.1.2
30
+ jsonschema==4.17.3
31
+ kiwisolver==1.4.4
32
+ linkify-it-py==2.0.0
33
+ llvmlite==0.39.1
34
+ markdown-it-py==2.2.0
35
+ MarkupSafe==2.1.2
36
+ matplotlib==3.7.1
37
+ mdit-py-plugins==0.3.3
38
+ mdurl==0.1.2
39
+ more-itertools==9.1.0
40
+ mpmath==1.3.0
41
+ multidict==6.0.4
42
+ networkx==3.0
43
+ numba==0.56.4
44
+ numpy==1.23.5
45
+ openai-whisper @ git+https://github.com/openai/whisper.git@6dea21fd7f7253bfe450f1e2512a0fe47ee2d258
46
+ orjson==3.8.8
47
+ packaging==23.0
48
+ pandas==1.5.3
49
+ Pillow==9.4.0
50
+ pydantic==1.10.7
51
+ pydub==0.25.1
52
+ pyparsing==3.0.9
53
+ pyrsistent==0.19.3
54
+ python-dateutil==2.8.2
55
+ python-multipart==0.0.6
56
+ pytz==2023.2
57
+ PyYAML==6.0
58
+ regex==2023.3.23
59
+ requests==2.28.2
60
+ rfc3986==1.5.0
61
+ semantic-version==2.10.0
62
+ six==1.16.0
63
+ sniffio==1.3.0
64
+ starlette==0.26.1
65
+ sympy==1.11.1
66
+ tiktoken==0.3.1
67
+ toolz==0.12.0
68
+ torch==2.0.0
69
+ tqdm==4.65.0
70
+ typing_extensions==4.5.0
71
+ uc-micro-py==1.0.1
72
+ urllib3==1.26.15
73
+ uvicorn==0.21.1
74
+ websockets==10.4
75
+ yarl==1.8.2
76
+ zipp==3.15.0