Spaces:
Build error
Build error
use summary
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def summarize(filename, provider='openai'):
|
|
| 32 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 33 |
response = requests.request("POST", API_URL, headers=headers, data=data)
|
| 34 |
if response.status_code == 200:
|
| 35 |
-
return json.loads(response.content.decode("utf-8"))
|
| 36 |
else:
|
| 37 |
return {"error": response.content}
|
| 38 |
|
|
@@ -42,9 +42,11 @@ demo = gr.Block()
|
|
| 42 |
with demo:
|
| 43 |
audio_file = gr.Audio(type="filepath")
|
| 44 |
text = gr.Textbox()
|
| 45 |
-
label = gr.
|
| 46 |
|
| 47 |
b1 = gr.Button("Derive Transcript")
|
| 48 |
b2 = gr.Button("Summarize")
|
| 49 |
|
|
|
|
|
|
|
| 50 |
demo.launch()
|
|
|
|
| 32 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 33 |
response = requests.request("POST", API_URL, headers=headers, data=data)
|
| 34 |
if response.status_code == 200:
|
| 35 |
+
return json.loads(response.content.decode("utf-8")).get('text')
|
| 36 |
else:
|
| 37 |
return {"error": response.content}
|
| 38 |
|
|
|
|
| 42 |
with demo:
|
| 43 |
audio_file = gr.Audio(type="filepath")
|
| 44 |
text = gr.Textbox()
|
| 45 |
+
label = gr.Textbox()
|
| 46 |
|
| 47 |
b1 = gr.Button("Derive Transcript")
|
| 48 |
b2 = gr.Button("Summarize")
|
| 49 |
|
| 50 |
+
b1.click(query, inputs=audio_file, outputs=text)
|
| 51 |
+
b2.click(summarize, inputs=text, outputs=label)
|
| 52 |
demo.launch()
|