Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,11 +6,9 @@ from surya.model.recognition.model import load_model as load_rec_model
|
|
| 6 |
from surya.model.recognition.processor import load_processor as load_rec_processor
|
| 7 |
from PIL import Image
|
| 8 |
import torch
|
| 9 |
-
import tempfile
|
| 10 |
import os
|
| 11 |
import re
|
| 12 |
import json
|
| 13 |
-
import base64
|
| 14 |
from groq import Groq
|
| 15 |
from st_keyup import st_keyup
|
| 16 |
|
|
@@ -109,15 +107,17 @@ model_choice = st.sidebar.selectbox("Select OCR Model:", ("GOT_CPU", "GOT_GPU",
|
|
| 109 |
uploaded_file = st.sidebar.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
|
| 110 |
|
| 111 |
# Input from clipboard
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
| 121 |
|
| 122 |
# Input from camera
|
| 123 |
camera_file = st.sidebar.camera_input("Capture from Camera")
|
|
|
|
| 6 |
from surya.model.recognition.processor import load_processor as load_rec_processor
|
| 7 |
from PIL import Image
|
| 8 |
import torch
|
|
|
|
| 9 |
import os
|
| 10 |
import re
|
| 11 |
import json
|
|
|
|
| 12 |
from groq import Groq
|
| 13 |
from st_keyup import st_keyup
|
| 14 |
|
|
|
|
| 107 |
uploaded_file = st.sidebar.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
|
| 108 |
|
| 109 |
# Input from clipboard
|
| 110 |
+
# Paste image button
|
| 111 |
+
paste_result = paste_image_button(
|
| 112 |
+
label="Paste Image from Clipboard",
|
| 113 |
+
text_color="#ffffff",
|
| 114 |
+
background_color="#3498db",
|
| 115 |
+
hover_background_color="#2980b9",
|
| 116 |
+
key='paste_button',
|
| 117 |
+
errors='ignore'
|
| 118 |
+
)
|
| 119 |
+
if paste_result:
|
| 120 |
+
uploaded_file = paste_result.image_data
|
| 121 |
|
| 122 |
# Input from camera
|
| 123 |
camera_file = st.sidebar.camera_input("Capture from Camera")
|