Spaces:
Runtime error
Runtime error
import gradio as gr | |
import openai | |
import os | |
from io import BytesIO | |
import tempfile | |
import boto3 | |
# s3 = boto3.client( | |
# 's3', | |
# aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"], | |
# aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"], | |
# region_name='ap-northeast-1' | |
# ) | |
def create_meeting_summary(openai_key, uploaded_audio): | |
openai.api_key = os.environ["OPENAI_API_KEY"] | |
transcript = openai.Audio.transcribe("whisper-1", open(uploaded_audio, "rb"), response_format="verbose_json") | |
transcript_text = "" | |
for segment in transcript.segments: | |
transcript_text += f"{segment['text']}\n" | |
# file_name = f'test.txt' | |
# csv_buffer = df_result.to_csv(index=False) | |
# s3.put_object(Bucket=bucket_name, Key=file_name, Body=csv_buffer) | |
return transcript_text | |
inputs = [ | |
gr.Audio(type="filepath", label="ι³ε£°γγ‘γ€γ«γγ’γγγγΌγ") | |
] | |
outputs = [ | |
gr.Textbox(label="γγ¦γ³γγΌγURL") | |
] | |
app = gr.Interface( | |
fn=create_meeting_summary, | |
inputs=inputs, | |
outputs=outputs, | |
title="ι³ε£°ζεθ΅·γγγ’γγͺ", | |
description="ι³ε£°γγ‘γ€γ«γγ’γγγγΌγγγ¦γζεθ΅·γγγγ‘γ€γ«γδ½ζγγΎγγ" | |
) | |
app.launch(share=True, debug=True, auth=("username", "password")) |