Changeset 16516


Ignore:
Timestamp:
Aug 10, 2016, 1:48:22 PM (3 years ago)
Author:
dferreira
Message:

Changes made to icon analysing and local or web images

Location:
internals/2016/aptoideimagesdetector/trunk/aptoide_mature_app_detector
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • internals/2016/aptoideimagesdetector/trunk/aptoide_mature_app_detector/aptoide_mature_app_detector/explicit_content_detector/API/Explicit_detector/analyse_app.py

    r16515 r16516  
    5656        if res:
    5757                c.execute(''' SELECT is_mature FROM final_results WHERE for_id=? ''',(res[0],))
    58                 res = c.fetchone()
    59                 db.close()
    60                 return res[0]
     58                res2 = c.fetchone()
     59                if res2:
     60                        db.close()
     61                        return res2[0]
     62                else:
     63                        tb_id = res[0]
    6164        else:
    6265                c.execute(''' INSERT INTO app (app_id, app_md5) VALUES (?,?) ''',(app_id,app_md5,))
     
    7578                exit(0)
    7679
    77         icons = []
     80        icon_l = []
    7881        screens = []
    7982        for icon in icons:
     
    8487                res = c.fetchone()
    8588                if res:
    86                         icons.append(('explicit',res[0]), ('safe',res[1]))
     89                        icon_l.append(('explicit',res[0]), ('safe',res[1]))
    8790                else:
    8891                        res = analyse_explicit(illust2vec, icon)
    89                         print "Analyse ICON"
    9092                        exp = False
    9193                        if res[0][1]>res[1][1]:
    9294                                exp = True
    93                         c.execute(''' INSERT INTO image_results VALUES (?,?,?,?,?,?,?,) ''',(int(tb_id), icon, res[0][1], res[1][1], exp, -1,  "icon",))
     95                        c.execute(''' INSERT INTO image_results VALUES (?,?,?,?,?,?,?) ''',(int(tb_id), icon, res[0][1], res[1][1], exp, -1,  "icon",))
    9496                        db.commit()
    95                         icons.append(res)
     97                        icon_l.append(res)
    9698
    9799        for scr in screenshots:
     
    171173                features['desc_exp'] = description_result.prob('exp')
    172174                return features
    173         features = find_features(icons, screens, description)
     175        features = find_features(icon_l, screens, description)
    174176
    175177        # Save and close the database
  • internals/2016/aptoideimagesdetector/trunk/aptoide_mature_app_detector/aptoide_mature_app_detector/explicit_content_detector/API/views.py

    r16515 r16516  
    88# or
    99# http://127.0.0.1:8000/detect_mature/id=md5_of_app
     10
     11# If you don't have acess to local images, change the config.json "local_or_web_images" to "web" instead of "local"
    1012
    1113import os
     
    132134                webpage = urllib2.urlopen(url+str(app_id)+"/json")
    133135                soup = BeautifulSoup(webpage, "lxml")
    134                                
     136                                       
    135137                text = soup.get_text()
    136138                page = json.loads(text)
  • internals/2016/aptoideimagesdetector/trunk/aptoide_mature_app_detector/config.json

    r16515 r16516  
    22        "directories": {
    33                "_Comments":"paths should always be relative to django project (where you run manage.py runserver)",
    4                 "_Comments2":"local or web images should be changed to web if you do not have local acess to the images",
     4                "_Comments2":"local_or_web_images should be changed to web if you do not have local acess to the images",
    55                "local_or_web_images":"local",
    66                "local_image_path_prefix": "imgs",
  • internals/2016/aptoideimagesdetector/trunk/aptoide_mature_app_detector/requirements.txt

    r16491 r16516  
    1818> import nltk
    1919> nltk.download(‘all’)
     20
     21If you don't have acess to local images, change the config.json "local_or_web_images" to "web" instead of "local"
Note: See TracChangeset for help on using the changeset viewer.