Files
ocr.yauk.tv/app.py
2025-01-23 21:09:49 +09:00

12 lines
583 B
Python

try: import os, sys, io, tempfile, streamlit
except: os.system(f'{sys.executable} -m pip install -q streamlit')
finally: import streamlit as st
if st.runtime.exists():
st.title('맥모닝 OCR')
if img := st.file_uploader("Choose a file"):
st.image(io.BytesIO(blob := img.getvalue()))
with tempfile.TemporaryDirectory() as tmp, \
open(path := f'{tmp}/{img.name}', 'wb') as f:
f.write(blob)
st.code(os.popen(f'osascript ocr.applescript {path}').read())
else: os.system('streamlit run app.py --browser.gatherUsageStats false')