Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1237,6 +1237,15 @@ def summarize_with_huggingface(api_key, file_path):
|
|
| 1237 |
|
| 1238 |
|
| 1239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1240 |
def process_text(api_key,text_file):
|
| 1241 |
summary,message = summarize_with_huggingface(api_key,text_file)
|
| 1242 |
if summary:
|
|
@@ -1274,8 +1283,7 @@ def launch_ui(demo_mode=False):
|
|
| 1274 |
fn=lambda *args: process_url(*args, demo_mode=demo_mode),
|
| 1275 |
inputs=inputs,
|
| 1276 |
outputs=[
|
| 1277 |
-
gr.components.Textbox(label="Transcription", value=
|
| 1278 |
-
# gr.components.Textbox(label="Transcription", value=lambda json_data: process_transcription(json_data), max_lines=10),
|
| 1279 |
# gr.components.Textbox(label="Transcription", value=lambda: "", max_lines=10),
|
| 1280 |
gr.components.Textbox(label="Summary or Status Message"),
|
| 1281 |
gr.components.File(label="Download Transcription as JSON"),
|
|
|
|
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
+
def format_transcription(transcription_result):
|
| 1241 |
+
if transcription_result:
|
| 1242 |
+
json_data = transcription_result['transcription']
|
| 1243 |
+
return json.dumps(json_data, indent=2)
|
| 1244 |
+
else:
|
| 1245 |
+
return ""
|
| 1246 |
+
|
| 1247 |
+
|
| 1248 |
+
|
| 1249 |
def process_text(api_key,text_file):
|
| 1250 |
summary,message = summarize_with_huggingface(api_key,text_file)
|
| 1251 |
if summary:
|
|
|
|
| 1283 |
fn=lambda *args: process_url(*args, demo_mode=demo_mode),
|
| 1284 |
inputs=inputs,
|
| 1285 |
outputs=[
|
| 1286 |
+
gr.components.Textbox(label="Transcription", value=format_transcription, max_lines=10),
|
|
|
|
| 1287 |
# gr.components.Textbox(label="Transcription", value=lambda: "", max_lines=10),
|
| 1288 |
gr.components.Textbox(label="Summary or Status Message"),
|
| 1289 |
gr.components.File(label="Download Transcription as JSON"),
|