Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
- improved handling of prediction
- minor component change
- bumpped up app version

Signed-off-by: sarthakpranesh <sarthakpranesh08@gmail.com>
  • Loading branch information
sarthakpranesh committed Nov 15, 2021
1 parent 9c723e3 commit 4f026f6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
41 changes: 26 additions & 15 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default function App() {
images: [],
description: "",
link: "",
loaded: false,
});
const [recognized, setRecognized] = useState<string[]>([]);

Expand Down Expand Up @@ -117,6 +118,7 @@ export default function App() {
images: [],
description: "",
link: "",
loaded: false,
}),
]);
// animate bottom sheet to cover whole screen
Expand All @@ -132,6 +134,7 @@ export default function App() {
);
}
const details = await getPlantDetails(predictPayload.predictions[0].name);
details.loaded = true;
setDetails(details);
} catch (err: any) {
console.log(err.message);
Expand Down Expand Up @@ -179,23 +182,31 @@ export default function App() {
return (
<>
<H3 text="Description" />
{details.description.length === 0 ? (
{!details.loaded ? (
<Paragraph text="Loading..." />
) : (
<>
<Paragraph text={details.description} />
<TouchableOpacity
onPress={() => {
if (details.link !== "") {
Linking.openURL(details.link);
}
}}
>
<H3
style={{ color: "blue", marginTop: 0 }}
text="Open in Wikipedia"
/>
</TouchableOpacity>
<Paragraph
text={
details.description.length === 0
? "Can't find Wiki details"
: details.description
}
/>
{details.description.length === 0 ? null : (
<TouchableOpacity
onPress={() => {
if (details.link !== "") {
Linking.openURL(details.link);
}
}}
>
<H3
style={{ color: "blue", marginTop: 0 }}
text="Open in Wikipedia"
/>
</TouchableOpacity>
)}
</>
)}
</>
Expand Down Expand Up @@ -254,7 +265,7 @@ export default function App() {
<Paragraph text="Try taking a photo of your favorite flower, and see what they're called, or Do you already have a flower photo? Open the image gallery to select it." />
<H2 text="About" />
<Paragraph
text={`PlantRecog is an Open Source project, it allows you to know plants with just a click. How we do it? We run our Tensorflow based image classification model as an API service using Nodejs. All the components (service + app + research) used in the project are available on Github and we can currently recognize ${recognized.length} plants from there flowers. Show your support by leaving a 🌟 on our Github Repo (click icon below)`}
text={`PlantRecog is an Open Source project, which allows you to know plants with just a click. All the components (service + app + research) used in the project are available on Github. The app can currently recognize ${recognized.length} plants from there flowers.`}
/>
<TouchableOpacity
style={styles.github}
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ android {
applicationId "com.plantrecog"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 9
versionName "0.7.0"
versionCode 10
versionName "0.8.0"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "PlantRecog",
"slug": "PlantRecog",
"version": "0.7.0",
"version": "0.8.0",
"assetBundlePatterns": [
"**/*"
]
Expand Down
2 changes: 1 addition & 1 deletion components/Typography/Paragraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Paragraph = ({ text, style }: ParagraphParams) => {
style={[
{
fontSize: RFValue(14),
fontWeight: "800",
fontWeight: "900",
color: "#373D3F",
textAlign: "justify",
},
Expand Down
1 change: 1 addition & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare type PlantDetails = {
images: string[];
description: string;
link: string;
loaded: boolean;
};

// API PAYLOADS
Expand Down

0 comments on commit 4f026f6

Please sign in to comment.