Spaces:
Sleeping
Sleeping
Update app.py
Browse files285 unmodified lines28628728828929029129229312 unmodified lines30630730830931031131277 unmodified lines390391392393394395396397398214 unmodified lines613614615616617618619620621285 unmodified linesbody = e.response.text[:800]except Exception:passreturn pd.DataFrame(), gr.update(choices=[], value=None), f"HTTP error: {e}{body}"except Exception as e:return pd.DataFrame(), gr.update(choices=[], value=None), f"Load error: {e}"12 unmodified lines# Download only if not exists (avoid re-fetch)if not os.path.exists(fpath) or os.path.getsize(fpath) == 0:fpath, url_used = fetch_mp3_by_unique_id(unique_id)html = f'URL: <a href="{url_used}" target="_blank">{url_used}</a>'return html, fpath, fpath, "Ready ✅"except requests.HTTPError as e:body = ""77 unmodified linesmsg = str(e)try:if hasattr(e, "args") and e.args:msg = msg + "" + str(e.args[0])except Exception:passreturn f"Error during model call: {msg}"214 unmodified linesreturn (info, None, info, gr.update())# Save to .txt and returnresults_text = "".join(results_blocks)fname = f"/tmp/batch_analysis_{(date_str or _today_str()).strip()}_{t_from.replace(':','')}-{t_to.replace(':','')}_{int(time.time())}.txt"with open(fname, "w", encoding="utf-8") as f:f.write(results_text)285 unmodified lines28628728828929029129229329412 unmodified lines30730830931031131231377 unmodified lines391392393394395396397214 unmodified lines612613614615616617618285 unmodified linesbody = e.response.text[:800]except Exception:pass# CORRECTED LINE: Use triple quotes for multi-line f-stringreturn pd.DataFrame(), gr.update(choices=[], value=None), f"""HTTP error: {e}{body}"""except Exception as e:return pd.DataFrame(), gr.update(choices=[], value=None), f"Load error: {e}"12 unmodified lines# Download only if not exists (avoid re-fetch)if not os.path.exists(fpath) or os.path.getsize(fpath) == 0:fpath, url_used = fetch_mp3_by_unique_id(unique_id)html = f'<a href="{url_used}" target="_blank">Recording URL</a>'return html, fpath, fpath, "Ready ✅"except requests.HTTPError as e:body = ""77 unmodified linesmsg = str(e)try:if hasattr(e, "args") and e.args:msg = msg + "\n\n" + str(e.args[0])except Exception:passreturn f"Error during model call: {msg}"214 unmodified linesreturn (info, None, info, gr.update())# Save to .txt and returnresults_text = "\n\n".join(results_blocks)fname = f"/tmp/batch_analysis_{(date_str or _today_str()).strip()}_{t_from.replace(':','')}-{t_to.replace(':','')}_{int(time.time())}.txt"with open(fname, "w", encoding="utf-8") as f:f.write(results_text)
app.py+6-9