Spaces:
Sleeping
Sleeping
first
Browse files- README.md +4 -4
- app.py +28 -0
- flagged/log.csv +3 -0
- requirements.txt +1 -0
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.23.0
|
8 |
app_file: app.py
|
|
|
1 |
---
|
2 |
+
title: Callscreen
|
3 |
+
emoji: π
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.23.0
|
8 |
app_file: app.py
|
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
3 |
+
import os
|
4 |
+
openai.api_key = os.environ.get("openai_key")
|
5 |
+
|
6 |
+
def transcribe(audio):
|
7 |
+
audio_file = open(audio, "rb")
|
8 |
+
transcript = openai.Audio.transcribe("whisper-1", audio_file)
|
9 |
+
text = transcript.text
|
10 |
+
preprompt = "You are a very helpful sales coach. Please review the following cold call introduction for me. Tell me what you think of this cold call: "
|
11 |
+
res=openai.Completion.create(
|
12 |
+
model="text-davinci-003",
|
13 |
+
prompt= preprompt + text,
|
14 |
+
max_tokens=256,
|
15 |
+
temperature=0
|
16 |
+
)
|
17 |
+
|
18 |
+
response = str(res["choices"][0]["text"].strip())
|
19 |
+
full = f"{text}\n\nThank you, my review below:\n{response}"
|
20 |
+
return full
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
ui = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
|
27 |
+
|
28 |
+
ui.launch()
|
flagged/log.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
audio,output,flag,username,timestamp
|
2 |
+
,,,,2023-03-21 16:53:05.252308
|
3 |
+
,,,,2023-03-21 16:53:06.735308
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
openai
|