Spaces:
Sleeping
Sleeping
intuitive262
commited on
Commit
·
96376c2
1
Parent(s):
da194cb
Updated code files
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def extract_text(image, query):
|
|
31 |
|
32 |
image_inputs, video_inputs = process_vision_info(messages)
|
33 |
inputs = processor(text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt")
|
34 |
-
inputs = inputs.to("
|
35 |
|
36 |
generated_ids = vlm.generate(**inputs, max_new_tokens=200, temperature=0.7, top_p=0.9)
|
37 |
generated_ids_trimmed = [out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)]
|
@@ -59,6 +59,10 @@ with gr.Blocks() as main_app:
|
|
59 |
with gr.Column():
|
60 |
img_input = gr.Image(type="pil", label="Upload an Image")
|
61 |
query_input = gr.Textbox(label="Enter query for retrieval", placeholder="Query/Prompt")
|
|
|
|
|
|
|
|
|
62 |
search_input = gr.Textbox(label="Enter search term", placeholder="Search")
|
63 |
extract_button = gr.Button("Read Doc!")
|
64 |
search_button = gr.Button("Search!")
|
|
|
31 |
|
32 |
image_inputs, video_inputs = process_vision_info(messages)
|
33 |
inputs = processor(text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt")
|
34 |
+
inputs = inputs.to("cpu")
|
35 |
|
36 |
generated_ids = vlm.generate(**inputs, max_new_tokens=200, temperature=0.7, top_p=0.9)
|
37 |
generated_ids_trimmed = [out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)]
|
|
|
59 |
with gr.Column():
|
60 |
img_input = gr.Image(type="pil", label="Upload an Image")
|
61 |
query_input = gr.Textbox(label="Enter query for retrieval", placeholder="Query/Prompt")
|
62 |
+
gr.Markdwon("""
|
63 |
+
### Please use this prompt for text extraction
|
64 |
+
**What text can you identify in this image? Include everything, even if it's partially obscured or in the background.**
|
65 |
+
""")
|
66 |
search_input = gr.Textbox(label="Enter search term", placeholder="Search")
|
67 |
extract_button = gr.Button("Read Doc!")
|
68 |
search_button = gr.Button("Search!")
|