UniquePratham commited on
Commit
0fbad84
β€’
1 Parent(s): 4471205

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -9,9 +9,12 @@ import torch
9
  import os
10
  import re
11
  import json
 
 
12
  from groq import Groq
13
  from st_keyup import st_keyup
14
- from streamlit_paste_button import paste_image_button
 
15
 
16
  # Page configuration
17
  st.set_page_config(page_title="DualTextOCRFusion", page_icon="πŸ”", layout="wide")
@@ -109,16 +112,12 @@ uploaded_file = st.sidebar.file_uploader("Choose an image...", type=["png", "jpg
109
 
110
  # Input from clipboard
111
  # Paste image button
112
- paste_result = paste_image_button(
113
- label="Paste Image from Clipboard",
114
- text_color="#ffffff",
115
- background_color="#3498db",
116
- hover_background_color="#2980b9",
117
- key='paste_button',
118
- errors='ignore'
119
- )
120
- if paste_result:
121
- uploaded_file = paste_result.image_data
122
 
123
  # Input from camera
124
  camera_file = st.sidebar.camera_input("Capture from Camera")
 
9
  import os
10
  import re
11
  import json
12
+ import io
13
+ import base64
14
  from groq import Groq
15
  from st_keyup import st_keyup
16
+ from st_img_pastebutton import paste
17
+
18
 
19
  # Page configuration
20
  st.set_page_config(page_title="DualTextOCRFusion", page_icon="πŸ”", layout="wide")
 
112
 
113
  # Input from clipboard
114
  # Paste image button
115
+ image_data = paste(label="paste from clipboard",key="image_clipboard")
116
+ if image_data is not None:
117
+ header, encoded = image_data.split(",", 1)
118
+ decoded_bytes = base64.b64decode(encoded)
119
+ img_stream = io.BytesIO(decoded_bytes)
120
+ uploaded_file=img_stream
 
 
 
 
121
 
122
  # Input from camera
123
  camera_file = st.sidebar.camera_input("Capture from Camera")