Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,171 Bytes
988c093 b31bef1 988c093 b31bef1 988c093 43d09a2 988c093 43d09a2 988c093 43d09a2 988c093 43d09a2 988c093 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import subprocess
import sys
def install_packages():
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'pip'])
with open('requirements.txt') as f:
packages = f.read().splitlines()
for package in packages:
if package and not package.startswith('#'):
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
if __name__ == "__main__":
print("Installing required packages...")
install_packages()
import gradio as gr
import torch
from transformers import AutoProcessor
def process_handwriting(image):
if image is None:
return "กรุณาอัพโหลดรูปภาพ"
return f"ทดสอบระบบ: Torch version: {torch.__version__}, Transformers installed"
demo = gr.Interface(
fn=process_handwriting,
inputs=gr.Image(type="pil", label="อัพโหลดรูปภาพ"),
outputs=gr.Textbox(label="ผลลัพธ์"),
title="Test Installation",
description="ทดสอบการติดตั้ง libraries"
)
demo.launch() |