Spaces:
Sleeping
Sleeping
add summary
Browse files
app.py
CHANGED
@@ -19,6 +19,8 @@ ydl_opts = {
|
|
19 |
# 'proxy': 'socks5://192.168.2.18:20170',
|
20 |
}
|
21 |
|
|
|
|
|
22 |
def download_audio(url):
|
23 |
if os.path.exists('demo.m4a'):
|
24 |
os.remove('demo.m4a')
|
@@ -32,12 +34,11 @@ def download_audio(url):
|
|
32 |
file=f,
|
33 |
response_format="text"
|
34 |
)
|
35 |
-
|
36 |
-
|
37 |
return transcription
|
38 |
|
39 |
def summarize_text():
|
40 |
-
text = output.value
|
41 |
prompt = f"Please summarize the following article in 5 sentences or less: [{text}]"
|
42 |
print(prompt)
|
43 |
message = claude_client.messages.create(
|
@@ -57,7 +58,7 @@ with gr.Blocks() as demo:
|
|
57 |
button_download = gr.Button("Download")
|
58 |
|
59 |
with gr.Row():
|
60 |
-
output = gr.TextArea(label="Output")
|
61 |
|
62 |
with gr.Column():
|
63 |
button_summary = gr.Button("Summary")
|
|
|
19 |
# 'proxy': 'socks5://192.168.2.18:20170',
|
20 |
}
|
21 |
|
22 |
+
text = ''
|
23 |
+
|
24 |
def download_audio(url):
|
25 |
if os.path.exists('demo.m4a'):
|
26 |
os.remove('demo.m4a')
|
|
|
34 |
file=f,
|
35 |
response_format="text"
|
36 |
)
|
37 |
+
global text
|
38 |
+
text = transcription
|
39 |
return transcription
|
40 |
|
41 |
def summarize_text():
|
|
|
42 |
prompt = f"Please summarize the following article in 5 sentences or less: [{text}]"
|
43 |
print(prompt)
|
44 |
message = claude_client.messages.create(
|
|
|
58 |
button_download = gr.Button("Download")
|
59 |
|
60 |
with gr.Row():
|
61 |
+
output = gr.TextArea(label="Output")
|
62 |
|
63 |
with gr.Column():
|
64 |
button_summary = gr.Button("Summary")
|