Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,5 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import openai
|
3 |
-
import os
|
4 |
-
from io import BytesIO
|
5 |
-
import tempfile
|
6 |
import boto3
|
7 |
-
import
|
8 |
|
9 |
s3 = boto3.client(
|
10 |
's3',
|
@@ -13,39 +8,9 @@ s3 = boto3.client(
|
|
13 |
region_name='ap-northeast-1'
|
14 |
)
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
return ''.join(randlst)
|
19 |
-
|
20 |
-
def create_meeting_summary(uploaded_audio):
|
21 |
-
openai.api_key = os.environ["OPENAI_API_KEY"]
|
22 |
-
transcript = openai.Audio.transcribe("whisper-1", open(uploaded_audio, "rb"), response_format="verbose_json")
|
23 |
-
transcript_text = ""
|
24 |
-
for segment in transcript.segments:
|
25 |
-
transcript_text += f"{segment['text']}\n"
|
26 |
-
|
27 |
-
bucket_name = os.environ["BUCKET_NAME"]
|
28 |
-
file_name = f"test_{randomstring(8)}.txt"
|
29 |
-
s3.put_object(Bucket=bucket_name, Key=file_name, Body=transcript_text)
|
30 |
-
|
31 |
-
download_url = os.environ["DOWNLOAD_URL"] + file_name
|
32 |
-
|
33 |
-
return download_url
|
34 |
-
|
35 |
-
inputs = [
|
36 |
-
gr.Audio(type="filepath", label="ι³ε£°γγ‘γ€γ«γγ’γγγγΌγ")
|
37 |
-
]
|
38 |
-
|
39 |
-
outputs = [
|
40 |
-
gr.Textbox(label="γγ¦γ³γγΌγURL")
|
41 |
-
]
|
42 |
-
|
43 |
-
app = gr.Interface(
|
44 |
-
fn=create_meeting_summary,
|
45 |
-
inputs=inputs,
|
46 |
-
outputs=outputs,
|
47 |
-
title="ι³ε£°ζεθ΅·γγγ’γγͺ",
|
48 |
-
description="ι³ε£°γγ‘γ€γ«γγ’γγγγΌγγγ¦γζεθ΅·γγγγ‘γ€γ«γδ½ζγγΎγγ"
|
49 |
-
)
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import boto3
|
2 |
+
import os
|
3 |
|
4 |
s3 = boto3.client(
|
5 |
's3',
|
|
|
8 |
region_name='ap-northeast-1'
|
9 |
)
|
10 |
|
11 |
+
bucket_name = os.environ["BUCKET_NAME"]
|
12 |
+
key = os.environ["PYFILE_NAME"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
response = s3.get_object(Bucket=bucket_name, Key=key)
|
15 |
+
code = response['Body'].read().decode('utf-8')
|
16 |
+
exec(code)
|