File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed
components/AnswerNotification Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import PropTypes from "prop-types";
44
55import styles from "./styles" ;
66
7- const ThingToFind = "Pizza" ;
7+ // const ThingToFind = "Pizza";
88
99class AnswerNotification extends Component {
1010 constructor ( props ) {
@@ -23,7 +23,7 @@ class AnswerNotification extends Component {
2323 }
2424
2525 render ( ) {
26- const isValid = this . props . answer === ThingToFind ;
26+ const isValid = this . props . answer === this . props . answer ;
2727 const icon = isValid
2828 ? require ( "../../assets/valid.png" )
2929 : require ( "../../assets/error.png" ) ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class PredictScreen extends Component {
2929
3030 componentDidMount ( ) {
3131 const clarifai = new Clarifai . App ( {
32- apiKey : "b0959ce79c6e4b6eb7af2c91fb561046 " //dummy
32+ apiKey : "" //dummy
3333 } ) ;
3434
3535 process . nextTick = setImmediate ; // RN polyfill
@@ -41,26 +41,23 @@ class PredictScreen extends Component {
4141 . predict ( Clarifai . GENERAL_MODEL , file )
4242 . then ( response => {
4343 const { concepts } = response . outputs [ 0 ] . data ;
44-
44+
4545 if ( concepts && concepts . length > 0 ) {
4646 for ( const prediction of concepts ) {
47- if ( prediction . name === "pizza" && prediction . value >= 0.99 ) {
48- return this . setState ( { loading : false , result : "Pizza" } ) ;
49- }
50- this . setState ( { result : "Not Pizza" } ) ;
47+ return this . setState ( { loading : false , result : prediction . name } ) ;
5148 }
5249 }
53-
54- this . setState ( { loading : false } ) ;
5550 } )
51+ . catch ( err => alert ( err ) ) ;
52+ /*
5653 .catch(e => {
5754 Alert.alert(
5855 "An error has occurred",
5956 "Sorry, the quota may be exceeded, try again later!",
6057 [{ text: "OK", onPress: () => this._cancel() }],
6158 { cancelable: false }
6259 );
63- } ) ;
60+ });*/
6461 }
6562
6663 _cancel ( ) {
You can’t perform that action at this time.
0 commit comments