Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -53,12 +53,43 @@ def infer(image_in): 
     | 
|
| 53 | 
         | 
| 54 | 
         
             
                return cleaned_text
         
     | 
| 55 | 
         | 
| 56 | 
         
            -
             
     | 
| 57 | 
         
            -
             
     | 
| 58 | 
         
            -
             
     | 
| 59 | 
         
            -
             
     | 
| 60 | 
         
            -
             
     | 
| 61 | 
         
            -
                 
     | 
| 62 | 
         
            -
             
     | 
| 63 | 
         
            -
                 
     | 
| 64 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 53 | 
         | 
| 54 | 
         
             
                return cleaned_text
         
     | 
| 55 | 
         | 
| 56 | 
         
            +
            title = "LLM Agent from a Picture",
         
     | 
| 57 | 
         
            +
            description = "Get a LLM system prompt from a picture to then use in GPT-Baker."
         
     | 
| 58 | 
         
            +
             
     | 
| 59 | 
         
            +
            css = """
         
     | 
| 60 | 
         
            +
            #col-container{
         
     | 
| 61 | 
         
            +
                margin: 0 auto;
         
     | 
| 62 | 
         
            +
                max-width: 840px;
         
     | 
| 63 | 
         
            +
                text-align: left;
         
     | 
| 64 | 
         
            +
            }
         
     | 
| 65 | 
         
            +
            """
         
     | 
| 66 | 
         
            +
             
     | 
| 67 | 
         
            +
            with gr.Blocks(css=css) as demo:
         
     | 
| 68 | 
         
            +
                with gr.Column(elem_id="col-container"):
         
     | 
| 69 | 
         
            +
                    gr.HTML(f"""
         
     | 
| 70 | 
         
            +
                    <h2 style="text-align: center;">{title}</h2>
         
     | 
| 71 | 
         
            +
                    <p style="text-align: center;">{description}</p>
         
     | 
| 72 | 
         
            +
                    """)
         
     | 
| 73 | 
         
            +
                with gr.Row():
         
     | 
| 74 | 
         
            +
                    with gr.Column():
         
     | 
| 75 | 
         
            +
                        image_in = gr.Image(
         
     | 
| 76 | 
         
            +
                            label = "Image reference",
         
     | 
| 77 | 
         
            +
                            type = "filepath"
         
     | 
| 78 | 
         
            +
                        )
         
     | 
| 79 | 
         
            +
                        submit_btn = gr.Button("Make LLM system from my pic !")
         
     | 
| 80 | 
         
            +
                    with gr.Column():
         
     | 
| 81 | 
         
            +
                        result = gr.Textbox(
         
     | 
| 82 | 
         
            +
                            label ="Suggested System"
         
     | 
| 83 | 
         
            +
                        )
         
     | 
| 84 | 
         
            +
             
     | 
| 85 | 
         
            +
                submit_btn.click(
         
     | 
| 86 | 
         
            +
                    fn = infer,
         
     | 
| 87 | 
         
            +
                    inputs = [
         
     | 
| 88 | 
         
            +
                        image_in
         
     | 
| 89 | 
         
            +
                    ],
         
     | 
| 90 | 
         
            +
                    outputs =[
         
     | 
| 91 | 
         
            +
                        result
         
     | 
| 92 | 
         
            +
                    ]
         
     | 
| 93 | 
         
            +
                )
         
     | 
| 94 | 
         
            +
             
     | 
| 95 | 
         
            +
            demo.queue().launch()
         
     |