Ejemplo n.º 1
0
def page():
    Name = t1.get()
    Purpose = purpose.get()
    Age = t3.get()
    Gender = gender.get()
    City = city.get()
    Mobile = t6.get()

    PyMongo.insertNew(Name, Gender, City, Age, Purpose, Mobile)
    engine.say("Thank you for response")
    cv2.waitKey(2)

    execfile("dataSetCreator.py")
Ejemplo n.º 2
0
def page():
    name = t1.get()
    age = t3.get()
    if (float(age).is_integer() and 0 < age < 100):
        page = Tk()

        lp1 = Label(page, text="Data Entered Successfully")
        lp1.pack()

    PyMongo.insertNew(Name, Gender, City, Age, Purpose)
    lp1 = Label(page, text="Data Entered Successfully")
    lp1.grid(row=11, column=1)
    cv2.waitKey(100)
    execfile("dataSetCreator.py")
Ejemplo n.º 3
0
def page():
    
    age=t1.get()
    
    City=city.get()
    Purpose=purpose.get()

    PyMongo.insertPrev(id,City,age,Purpose)
        
    #lp1 = Label(page,text="Data Entered Successfully")
    #lp1.pack()
    engine = pyttsx.init('sapi5');
    #cv2.waitKey(2);
    engine.say("Your data is successfully recorded ");
    engine.runAndWait()
    execfile("detector.py")
Ejemplo n.º 4
0
def create_app(config):
    app = Flask(__name__)

    app.config.from_object(config)

    app.register_blueprint(route_path_general, url_prefix='/api')
    app.register_blueprint(picture_blueprint)
    mongo = PyMongo(app)

    # START GLOBAL HTTP CONFIGURATIONS
    @app.after_request
    def add_header(response):
        return response

    @app.errorhandler(400)
    def bad_request(e):
        logging.error(e)
        return response_with(resp.BAD_REQUEST_400)

    @app.errorhandler(500)
    def server_error(e):
        logging.error(e)
        return response_with(resp.SERVER_ERROR_500)

    @app.errorhandler(404)
    def not_found(e):
        logging.error(e)
        return response_with(resp.NOT_FOUND_HANDLER_404)

    # END GLOBAL HTTP CONFIGURATIONS

    @app.route("/api/v1.0/spec")
    def spec():
        swag = swagger(app, prefix='/api/v1.0')
        swag['info']['version'] = "1.0"
        swag['info']['title'] = "Flask Starter API"
        return jsonify(swag)

    db.init_app(app)
    with app.app_context():
        # from api.models import *
        db.create_all()

    logging.basicConfig(stream=sys.stdout,
                        format='%(asctime)s|%(levelname)s|%(filename)s:%(lineno)s|%(message)s',
                        level=logging.DEBUG)
    return app
Ejemplo n.º 5
0
def FetchInfo(id):
    profile1 = PyMongo.getProfile1(id)
    #print profile1

    profile2 = PyMongo.getProfile2(id)
    #print profile2

    name = profile1[0]
    gender = profile1[1]
    city = profile2[0]
    age = profile2[1]
    purpose = profile2[2]
    time = profile2[3]
    sm = 0

    if (city == "Sangli"):
        sm += (10)
    elif (city == "Miraj"):
        sm += (30)
    elif (city == "Pune"):
        sm += (50)
    elif (city == "Mumbai"):
        sm += (70)
    #elif(60 < age < 80 or purpose == "Urgent"):
    #execfile('SMS.py')

    if (0 < age < 20):
        sm += 20
    elif (20 <= age < 40):
        sm += 40
    elif (40 <= age < 60):
        sm += 60

    if (purpose == "Meeting"):
        sm += 50
    elif (purpose == "Invitation"):
        sm += 30
    elif (purpose == "Personal"):
        sm += 10

    print sm
    print purpose
    print city
    print age

    if (sm > 150 or 60 < age < 80 or purpose == "Urgent"):
        SMS.SendSMS(name, gender, city, purpose, mobile="9604091697")

    else:
        new_profile1 = PyMongo.getProfile1(id)
        new_profile2 = PyMongo.getProfile2(id)
        PyMongo.SCInsert(id, sm, time)
        PyMongo.SCSchedule()
Ejemplo n.º 6
0
                                        scaleFactor=1.3,
                                        minNeighbors=4,
                                        minSize=(30, 30),
                                        flags=cv2.CASCADE_SCALE_IMAGE)

    for (x, y, w, h) in faces:
        cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
        id, conf = rec.predict(gray[y:y + h, x:x + w])
        ls.append(id)

    cnt += 1
    if (cnt == 20):
        cnt = 0
        id = max(ls)
        ls = []
        profile = PyMongo.GetName(float(id))
        print profile

        engine = pyttsx.init('sapi5')
        engine.say("Namaskaar !")
        cv2.waitKey(2)
        engine.say("Welcome to collector office ,Saanglee!" + str(profile))
        cv2.waitKey(2)
        engine.say("Please fill the following information")
        cv2.waitKey(2)
        engine.runAndWait()
        city = raw_input("Enter city:")
        age = raw_input("Enter age:")
        purpose = raw_input("Enter purpose:")

        PyMongo.insertPrev(id, city, age, purpose)
Ejemplo n.º 7
0
import flask import Flask, render_template, jsonify, redirect
import flask_pymongo import PyMongo
import scrape_mars

app = Flask (__name__)

mongo= PyMongo(app)

@app.route("/")
def index():
    mars = mongo.db.mars.find_one()
    return render_template("index.html", mars=mars)


@app.route("/scrape")
def scrape():
    mars = mongo.db.mars
    mars_data = scrape_mars.scrape()
    mars.update(
        {},
        mars_data,
        upsert=True
    )
    return redirect("http://localhost:5000/", code=302)


if __name__ == "__main__":
    app.run(debug=True)
Ejemplo n.º 8
0
# Imports
from flask import Flask, render_template, redirect, jsonify
from featured_img_scrape import get_featured_image
from mars_facts import get_mars_facts
from mars_hemisphere_pic_scrape import get_image
from mission_to_mars import get_title, get_body
import PyMongo 

# Create the App

app = Flask(__name__)

# Establish Mongo connection
mongodb = PyMongo(app, uri='http://127.0.0.1:5000/')

# Home route

@app.route("/")
def marsinfo():
    cerberus = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/cerberus_enhanced'
    schiaparelli = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/schiaparelli_enhanced'
    syrtis_major = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/syrtis_major_enhanced'
    valles_marineris = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/valles_marineris_enhanced'
    featured_image = get_featured_image()
    mars_facts = get_mars_facts()
    title = get_title()
    body = get_body()
    cerberus_info = get_image(cerberus)
    schiaparelli_info = get_image(schiaparelli)
    syrtis_major_info = get_image(syrtis_major)
    valles_marineris_info = get_image(valles_marineris)
Ejemplo n.º 9
0
    #imgNp=np.array(bytearray(imgResponse.read()),dtype=np.uint8)
    #img=cv2.imdecode(imgNp,-1)

    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    faces = faceDetect.detectMultiScale(gray,
                                        scaleFactor=1.3,
                                        minNeighbors=4,
                                        minSize=(30, 30),
                                        flags=cv2.CASCADE_SCALE_IMAGE)

    for (x, y, w, h) in faces:

        sampleNum = sampleNum + 1
        cv2.imwrite(
            'dataSet/User.' + str(int(PyMongo.GetID(Name))) + "." +
            str(sampleNum) + ".jpg", gray[y:y + h, x:x + w])
        cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)

    cv2.imshow("Please look here( src: webcam1)", img)

    cv2.waitKey(100)

    if (sampleNum >= 20):
        break

#imgResponse.release()
#sys.exit()
#cam.release()
engine.say("Thank you")
cv2.destroyAllWindows()
Ejemplo n.º 10
0
    #else:
        #print("Error")
        
    faces=faceDetect.detectMultiScale(gray, scaleFactor=1.3, minNeighbors=4, minSize=(30, 30), flags = cv2.CASCADE_SCALE_IMAGE)
    
    for(x,y,w,h) in faces:        
        cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)
        id,conf = rec.predict(gray[y:y+h,x:x+w])
        ls++.append(id)
                    
    cnt+=1
    if(cnt==20):
        cnt=0
        id=max(ls)
        ls=[]
        profile = PyMongo.GetName(float(id));
        print profile
        
        engine = pyttsx.init('sapi5');
        engine.say("Namaskaar !")
        cv2.waitKey(2);
        engine.say("Welcome to collector office ,Saanglee!"+str(profile));

        
        engine.runAndWait()

        cv2.waitKey(2)

        #engine.say("Thank you for the response !")
        #engine.runAndWait()