Spaces:
Running
Running
Commit
·
054c08e
1
Parent(s):
0f8e862
Uploaded code files
Browse files- app.py +3 -3
- requirements.txt +0 -1
app.py
CHANGED
@@ -41,7 +41,7 @@ def extract_text(image, query):
|
|
41 |
def post_process_text(text):
|
42 |
# Remove extra whitespace
|
43 |
text = re.sub(r'\s+', ' ', text).strip()
|
44 |
-
# Remove repeated phrases
|
45 |
phrases = text.split('. ')
|
46 |
unique_phrases = list(dict.fromkeys(phrases))
|
47 |
text = '. '.join(unique_phrases)
|
@@ -77,8 +77,8 @@ def main_fun(image, keyword):
|
|
77 |
iface = gr.Interface(
|
78 |
fn=main_fun,
|
79 |
inputs=[
|
80 |
-
gr.Image(type="pil", label="Upload an Image")
|
81 |
-
gr.Textbox(label="Enter search term")
|
82 |
],
|
83 |
outputs=[
|
84 |
gr.Textbox(label="Extracted Text"),
|
|
|
41 |
def post_process_text(text):
|
42 |
# Remove extra whitespace
|
43 |
text = re.sub(r'\s+', ' ', text).strip()
|
44 |
+
# Remove repeated phrases
|
45 |
phrases = text.split('. ')
|
46 |
unique_phrases = list(dict.fromkeys(phrases))
|
47 |
text = '. '.join(unique_phrases)
|
|
|
77 |
iface = gr.Interface(
|
78 |
fn=main_fun,
|
79 |
inputs=[
|
80 |
+
gr.Image(type="pil", label="Upload an Image"),
|
81 |
+
gr.Textbox(label="Enter search term", placeholder="Search")
|
82 |
],
|
83 |
outputs=[
|
84 |
gr.Textbox(label="Extracted Text"),
|
requirements.txt
CHANGED
@@ -3,7 +3,6 @@ byaldi
|
|
3 |
qwen-vl-utils
|
4 |
numpy==1.24.4
|
5 |
Pillow==10.3.0
|
6 |
-
Requests==2.31.0
|
7 |
torch
|
8 |
torchvision
|
9 |
git+https://github.com/huggingface/transformers.git
|
|
|
3 |
qwen-vl-utils
|
4 |
numpy==1.24.4
|
5 |
Pillow==10.3.0
|
|
|
6 |
torch
|
7 |
torchvision
|
8 |
git+https://github.com/huggingface/transformers.git
|