File size: 1,195 Bytes
da59cbe
 
95431d3
da59cbe
 
95431d3
da59cbe
 
 
08a2a10
 
 
 
da59cbe
6a648dd
0aa610a
da59cbe
 
4c219e4
6a648dd
da59cbe
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr

from askui_ml_helper.utils.pta_text import PtaTextInference

def main():
    inference = PtaTextInference("model/pta-text-v0.1.pt")
    # Gradio Interface
    iface = gr.Interface(
        fn=inference.process_image_and_draw_circle,
        inputs=[gr.Image(type="pil", label = "Upload Image"),
                gr.Textbox(label = "Prompt", placeholder='Enter a prompt to find in the image', value='click on the text "Login"'),
                gr.Slider(minimum=5, maximum=20, value=10, label="Prediction Dot Size", step=5),
                gr.Checkbox(label="Resize (Recommended)", value=True,  info="Resize the image to 1920x1080 for better results?")],
        outputs=gr.Image(type="pil"),
        title="PTA-Text: A **Text-only** Click Model",
        description="Based on PTA-text ([Huggingface model card](https://huggingface.co/AskUI/pta-text-0.1) ).PTA is a small part of our bigger model - PTA-1 (Prompt-To-Automation). \nInstructions: Upload a UI image and enter a text finding prompt to see the model's prediction. \nLimitations: Currently, limited to single screen images."
    )

    iface.launch(server_name="0.0.0.0")


if __name__ == "__main__":
    main()