gitlost-murali commited on
Commit
4077882
·
verified ·
1 Parent(s): d17e301

Add coordinates method

Browse files
Files changed (1) hide show
  1. README.md +20 -1
README.md CHANGED
@@ -37,7 +37,7 @@ Download the checkpoint ".pt" model from files in this model card.
37
 
38
  ## Running the model
39
 
40
- ### In full precision, on CPU:
41
 
42
  You can run the model in full precision on CPU:
43
  ```python
@@ -59,6 +59,25 @@ render_image.show()
59
 
60
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f993a63777efc07d7f1e2ce/ZNwjdENJqn-1VpXDcm_Wg.png)
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  # Contribution
63
 
64
  An AskUI's open source initiative. This model is contributed and added to the Hugging Face ecosystem by [Murali Manohar @ AskUI](https://huggingface.co/gitlost-murali).
 
37
 
38
  ## Running the model
39
 
40
+ ### Get the annotated image
41
 
42
  You can run the model in full precision on CPU:
43
  ```python
 
59
 
60
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f993a63777efc07d7f1e2ce/ZNwjdENJqn-1VpXDcm_Wg.png)
61
 
62
+ ### Get the coordinates
63
+
64
+ ```python
65
+ import requests
66
+ from PIL import Image
67
+ from askui_ml_helper.utils.pta_text import PtaTextInference
68
+
69
+ pta_text_inference = PtaTextInference("pta-text-v0.1.pt")
70
+
71
+ url = "https://docs.askui.com/assets/images/how_askui_works_architecture-363bc8be35bd228e884c83d15acd19f7.png"
72
+ image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
73
+ prompt = 'click on the text "Operating System"'
74
+
75
+
76
+ coordinates = pta_text_inference.process_image(image, prompt)
77
+ coordinates
78
+ >>> [0.3981265723705292, 0.13768285512924194]
79
+ ```
80
+
81
  # Contribution
82
 
83
  An AskUI's open source initiative. This model is contributed and added to the Hugging Face ecosystem by [Murali Manohar @ AskUI](https://huggingface.co/gitlost-murali).