Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +44 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import openai
|
3 |
+
import os
|
4 |
+
from io import BytesIO
|
5 |
+
import tempfile
|
6 |
+
import boto3
|
7 |
+
|
8 |
+
# s3 = boto3.client(
|
9 |
+
# 's3',
|
10 |
+
# aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
|
11 |
+
# aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
|
12 |
+
# region_name='ap-northeast-1'
|
13 |
+
# )
|
14 |
+
|
15 |
+
def create_meeting_summary(openai_key, uploaded_audio):
|
16 |
+
openai.api_key = os.environ["OPENAI_API_KEY"]
|
17 |
+
transcript = openai.Audio.transcribe("whisper-1", open(uploaded_audio, "rb"), response_format="verbose_json")
|
18 |
+
transcript_text = ""
|
19 |
+
for segment in transcript.segments:
|
20 |
+
transcript_text += f"{segment['text']}\n"
|
21 |
+
|
22 |
+
# file_name = f'test.txt'
|
23 |
+
# csv_buffer = df_result.to_csv(index=False)
|
24 |
+
# s3.put_object(Bucket=bucket_name, Key=file_name, Body=csv_buffer)
|
25 |
+
|
26 |
+
return transcript_text
|
27 |
+
|
28 |
+
inputs = [
|
29 |
+
gr.Audio(type="filepath", label="ι³ε£°γγ‘γ€γ«γγ’γγγγΌγ")
|
30 |
+
]
|
31 |
+
|
32 |
+
outputs = [
|
33 |
+
gr.Textbox(label="γγ¦γ³γγΌγURL")
|
34 |
+
]
|
35 |
+
|
36 |
+
app = gr.Interface(
|
37 |
+
fn=create_meeting_summary,
|
38 |
+
inputs=inputs,
|
39 |
+
outputs=outputs,
|
40 |
+
title="ι³ε£°ζεθ΅·γγγ’γγͺ",
|
41 |
+
description="ι³ε£°γγ‘γ€γ«γγ’γγγγΌγγγ¦γζεθ΅·γγγγ‘γ€γ«γδ½ζγγΎγγ"
|
42 |
+
)
|
43 |
+
|
44 |
+
app.launch(share=True, debug=True, auth=("username", "password"))
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
openai==0.27.2
|
2 |
+
boto3==1.26.114
|