Refactor project interface and remove unused utility files
Browse files- Update Gradio interface description to emphasize model evaluation
- Remove temporary slider and update project description
- Delete unused `goat.py` utility file and large model file
- Modify `.gitignore` to exclude additional files
- Comment out previously imported inference function
- .gitignore +2 -0
 - app.py +4 -11
 - large_model_3lakh_v1.h5 +0 -3
 - utils/goat.py +0 -15
 
    	
        .gitignore
    CHANGED
    
    | 
         @@ -1 +1,3 @@ 
     | 
|
| 1 | 
         
             
            .env
         
     | 
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
             
            .env
         
     | 
| 2 | 
         
            +
            *goat.py
         
     | 
| 3 | 
         
            +
            .vscode
         
     | 
    	
        app.py
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ from torchvision import transforms 
     | 
|
| 5 | 
         
             
            import torch
         
     | 
| 6 | 
         
             
            from PIL import Image
         
     | 
| 7 | 
         
             
            import numpy as np
         
     | 
| 8 | 
         
            -
            from utils.goat import call_inference
         
     | 
| 9 | 
         
             
            import io
         
     | 
| 10 | 
         
             
            import warnings
         
     | 
| 11 | 
         | 
| 
         @@ -503,7 +503,7 @@ def predict_image_with_html(img, confidence_threshold): 
     | 
|
| 503 | 
         | 
| 504 | 
         
             
            # Define the Gradio interface
         
     | 
| 505 | 
         
             
            with gr.Blocks() as iface:
         
     | 
| 506 | 
         
            -
                gr.Markdown("# AI Generated Image  
     | 
| 507 | 
         | 
| 508 | 
         
             
                with gr.Row():
         
     | 
| 509 | 
         
             
                    with gr.Column(scale=1):
         
     | 
| 
         @@ -511,15 +511,8 @@ with gr.Blocks() as iface: 
     | 
|
| 511 | 
         
             
                        confidence_slider = gr.Slider(0.0, 1.0, value=0.5, step=0.01, label="Confidence Threshold")
         
     | 
| 512 | 
         
             
                        inputs = [image_input, confidence_slider]
         
     | 
| 513 | 
         
             
                    with gr.Column(scale=2):
         
     | 
| 514 | 
         
            -
                        with gr.Accordion("Project OpenSight", open=True):
         
     | 
| 515 | 
         
            -
                            gr.Markdown("##  
     | 
| 516 | 
         
            -
                            temp_slider = gr.Slider(
         
     | 
| 517 | 
         
            -
                                0, 1,
         
     | 
| 518 | 
         
            -
                                value=0.1,
         
     | 
| 519 | 
         
            -
                                step=0.1,
         
     | 
| 520 | 
         
            -
                                interactive=True,
         
     | 
| 521 | 
         
            -
                                label="Slide me",
         
     | 
| 522 | 
         
            -
                            )
         
     | 
| 523 | 
         
             
                        image_output = gr.Image(label="Processed Image", visible=False)
         
     | 
| 524 | 
         
             
                        # Custom HTML component to display results in 5 columns
         
     | 
| 525 | 
         
             
                        results_html = gr.HTML(label="Model Predictions")
         
     | 
| 
         | 
|
| 5 | 
         
             
            import torch
         
     | 
| 6 | 
         
             
            from PIL import Image
         
     | 
| 7 | 
         
             
            import numpy as np
         
     | 
| 8 | 
         
            +
            # from utils.goat import call_inference / announcement soon
         
     | 
| 9 | 
         
             
            import io
         
     | 
| 10 | 
         
             
            import warnings
         
     | 
| 11 | 
         | 
| 
         | 
|
| 503 | 
         | 
| 504 | 
         
             
            # Define the Gradio interface
         
     | 
| 505 | 
         
             
            with gr.Blocks() as iface:
         
     | 
| 506 | 
         
            +
                gr.Markdown("# AI Generated Image / Deepfake Detection Models Evaluation")
         
     | 
| 507 | 
         | 
| 508 | 
         
             
                with gr.Row():
         
     | 
| 509 | 
         
             
                    with gr.Column(scale=1):
         
     | 
| 
         | 
|
| 511 | 
         
             
                        confidence_slider = gr.Slider(0.0, 1.0, value=0.5, step=0.01, label="Confidence Threshold")
         
     | 
| 512 | 
         
             
                        inputs = [image_input, confidence_slider]
         
     | 
| 513 | 
         
             
                    with gr.Column(scale=2):
         
     | 
| 514 | 
         
            +
                        with gr.Accordion("Project OpenSight - Model Evaluations & Playground", open=True):
         
     | 
| 515 | 
         
            +
                            gr.Markdown("## OpenSight is a SOTA gen. image detection model, in pre-release prep.\n\nThis HF Space is a temporary home for us and the public to evaluate the shortcomings of current open source models.")
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 516 | 
         
             
                        image_output = gr.Image(label="Processed Image", visible=False)
         
     | 
| 517 | 
         
             
                        # Custom HTML component to display results in 5 columns
         
     | 
| 518 | 
         
             
                        results_html = gr.HTML(label="Model Predictions")
         
     | 
    	
        large_model_3lakh_v1.h5
    DELETED
    
    | 
         @@ -1,3 +0,0 @@ 
     | 
|
| 1 | 
         
            -
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            -
            oid sha256:c9fbb9bbfb644a42f077e20a2b4da3d7240879303474236e77d045b89fd46fff
         
     | 
| 3 | 
         
            -
            size 180867592
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
    	
        utils/goat.py
    DELETED
    
    | 
         @@ -1,15 +0,0 @@ 
     | 
|
| 1 | 
         
            -
            import os
         
     | 
| 2 | 
         
            -
            import requests
         
     | 
| 3 | 
         
            -
            import json
         
     | 
| 4 | 
         
            -
             
     | 
| 5 | 
         
            -
            def call_inference(img):
         
     | 
| 6 | 
         
            -
                files = {
         
     | 
| 7 | 
         
            -
                    'image': ('image.jpg', img, 'image/jpeg')
         
     | 
| 8 | 
         
            -
                }
         
     | 
| 9 | 
         
            -
                print(img)
         
     | 
| 10 | 
         
            -
                
         
     | 
| 11 | 
         
            -
                response = requests.post(
         
     | 
| 12 | 
         
            -
                    "https://aiwb-sightmodel.web.val.run", 
         
     | 
| 13 | 
         
            -
                    files=files
         
     | 
| 14 | 
         
            -
                )
         
     | 
| 15 | 
         
            -
                return response.json()
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         |