diff --git a/src/components/AnswerNotification/index.js b/src/components/AnswerNotification/index.js index 94dfeb2..bac1c3e 100644 --- a/src/components/AnswerNotification/index.js +++ b/src/components/AnswerNotification/index.js @@ -4,7 +4,7 @@ import PropTypes from "prop-types"; import styles from "./styles"; -const ThingToFind = "Pizza"; +//const ThingToFind = "Pizza"; class AnswerNotification extends Component { constructor(props) { @@ -23,7 +23,7 @@ class AnswerNotification extends Component { } render() { - const isValid = this.props.answer === ThingToFind; + const isValid = this.props.answer === this.props.answer; const icon = isValid ? require("../../assets/valid.png") : require("../../assets/error.png"); diff --git a/src/screens/PredictScreen/index.js b/src/screens/PredictScreen/index.js index 0d1861b..879f503 100644 --- a/src/screens/PredictScreen/index.js +++ b/src/screens/PredictScreen/index.js @@ -29,7 +29,7 @@ class PredictScreen extends Component { componentDidMount() { const clarifai = new Clarifai.App({ - apiKey: "b0959ce79c6e4b6eb7af2c91fb561046" //dummy + apiKey: "" //dummy }); process.nextTick = setImmediate; // RN polyfill @@ -41,18 +41,15 @@ class PredictScreen extends Component { .predict(Clarifai.GENERAL_MODEL, file) .then(response => { const { concepts } = response.outputs[0].data; - + if (concepts && concepts.length > 0) { for (const prediction of concepts) { - if (prediction.name === "pizza" && prediction.value >= 0.99) { - return this.setState({ loading: false, result: "Pizza" }); - } - this.setState({ result: "Not Pizza" }); + return this.setState({ loading: false, result: prediction.name }); } } - - this.setState({ loading: false }); }) + .catch(err => alert(err)); + /* .catch(e => { Alert.alert( "An error has occurred", @@ -60,7 +57,7 @@ class PredictScreen extends Component { [{ text: "OK", onPress: () => this._cancel() }], { cancelable: false } ); - }); + });*/ } _cancel() {