pnnbao-ump commited on
Commit
737e40d
·
verified ·
1 Parent(s): 39e0265

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -3
app.py CHANGED
@@ -407,12 +407,20 @@ def ocr_and_translate_streaming(file_path, mode, page_num_str):
407
 
408
  # ==================== GRADIO INTERFACE ====================
409
 
410
- with gr.Blocks(theme=gr.themes.Soft(), title="OCR + Translation") as demo:
411
 
412
  gr.Markdown("""
413
- <div class="main-title">
414
  <h1>🦀 MedCrab Translation</h1>
415
- <p><b>Quét PDF Y khoa → Dịch trực tiếp sang tiếng Việt (Streaming)</b></p>
 
 
 
 
 
 
 
 
416
  </div>
417
  """)
418
 
@@ -436,6 +444,21 @@ with gr.Blocks(theme=gr.themes.Soft(), title="OCR + Translation") as demo:
436
  gr.Markdown("### 📄 Kết quả dịch tiếng Việt (Streaming)")
437
  translation_output = gr.HTML(label="", value="")
438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  with gr.Accordion("ℹ️ Hướng dẫn sử dụng", open=False):
440
  gr.Markdown("""
441
  **Quy trình đơn giản:**
@@ -449,6 +472,27 @@ with gr.Blocks(theme=gr.themes.Soft(), title="OCR + Translation") as demo:
449
  **Lưu ý:** Space này sử dụng GPU miễn phí của Hugging Face, có thể mất vài giây để khởi động.
450
  """)
451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  file_in.change(load_image, [file_in, page_input], [input_img])
453
  file_in.change(update_page_info, [file_in], [page_input])
454
  page_input.change(load_image, [file_in, page_input], [input_img])
 
407
 
408
  # ==================== GRADIO INTERFACE ====================
409
 
410
+ with gr.Blocks(theme=gr.themes.Soft(), title="MedCrab Translation") as demo:
411
 
412
  gr.Markdown("""
413
+ <div style="text-align: center;">
414
  <h1>🦀 MedCrab Translation</h1>
415
+ <p style="font-size: 18px;"><b>Quét PDF Y khoa → Dịch trực tiếp sang tiếng Việt (Streaming)</b></p>
416
+ <p style="font-size: 14px; color: #666;">
417
+ Model: <a href="https://huggingface.co/pnnbao-ump/MedCrab-1.5B" target="_blank">MedCrab-1.5B</a>
418
+ | Repo: <a href="https://github.com/pnnbao97/MedCrab" target="_blank">GitHub</a>
419
+ | Tác giả: <b>Phạm Nguyễn Ngọc Bảo</b>
420
+ </p>
421
+ <p style="font-size: 13px; color: #ff9800;">
422
+ 🚀 <b>Coming Soon:</b> MedCrab-8B sẽ ra mắt trong vài tuần tới!
423
+ </p>
424
  </div>
425
  """)
426
 
 
444
  gr.Markdown("### 📄 Kết quả dịch tiếng Việt (Streaming)")
445
  translation_output = gr.HTML(label="", value="")
446
 
447
+ # Note: Upload ảnh qua Web UI sau khi space chạy, rồi uncomment phần này:
448
+ # with gr.Accordion("📚 Ví dụ mẫu", open=True):
449
+ # gr.Markdown("**Thử ngay với các ví dụ có sẵn:**")
450
+ # gr.Examples(
451
+ # examples=[
452
+ # ["images/example 1.png", "Crab", "1"],
453
+ # ["images/example 2.png", "Crab", "1"]
454
+ # ],
455
+ # inputs=[file_in, mode, page_input],
456
+ # outputs=[translation_output],
457
+ # fn=ocr_and_translate_streaming,
458
+ # cache_examples=False,
459
+ # label="Nhấp vào ví dụ để thử"
460
+ # )
461
+
462
  with gr.Accordion("ℹ️ Hướng dẫn sử dụng", open=False):
463
  gr.Markdown("""
464
  **Quy trình đơn giản:**
 
472
  **Lưu ý:** Space này sử dụng GPU miễn phí của Hugging Face, có thể mất vài giây để khởi động.
473
  """)
474
 
475
+ with gr.Accordion("⚖️ Giấy phép & Liên hệ", open=False):
476
+ gr.Markdown("""
477
+ **Giấy phép:** CC BY-NC 4.0 (Creative Commons Attribution-NonCommercial 4.0 International)
478
+
479
+ ✅ **Được phép:**
480
+ - Sử dụng cá nhân
481
+ - Nghiên cứu học thuật
482
+ - Giáo dục
483
+
484
+ ❌ **Không được phép:**
485
+ - Sử dụng thương mại
486
+ - Triển khai tại bệnh viện/phòng khám mà không có giấy phép
487
+
488
+ **💼 Nhu cầu thương mại:**
489
+ Nếu bạn đại diện cho bệnh viện, phòng khám hoặc tổ chức y tế muốn sử dụng MedCrab cho mục đích thương mại,
490
+ vui lòng liên hệ trực tiếp tác giả:
491
+
492
+ 👤 **Phạm Nguyễn Ngọc Bảo**
493
+ 📧 Facebook: [facebook.com/bao.phamnguyenngoc.5](https://www.facebook.com/bao.phamnguyenngoc.5/)
494
+ """)
495
+
496
  file_in.change(load_image, [file_in, page_input], [input_img])
497
  file_in.change(update_page_info, [file_in], [page_input])
498
  page_input.change(load_image, [file_in, page_input], [input_img])