ZingTruyen.Xyz

एआई कोड्स नाल दुनियॉं दा इलाज

7

MarkPIcassoMPA


कहानी / परिचय

परिवार अब गर्म है और स्वच्छता और खाना बनाने के कौशल में सुधार हुआ है।
लेकिन बच्चे ने टॉयलेट जाने के बाद सफ़ेद और हिलते हुए मल का अनुभव किया और आप डर गए।
डॉक्टर उपलब्ध नहीं है।
लेकिन आपके फोन पर "Holistic Health Snap" ऐप है। आप बस तस्वीर लेते हैं और ऐप तुरंत समस्या पहचानकर समाधान बताता है।
इस मामले में, बच्चे में परजीवी (कीड़े) हैं, और ऐप सुरक्षित तरीके से उपाय बताता है।

React Native कोड (तस्वीर लेने और समस्या पहचानने के लिए)import React, { useState, useEffect } from 'react';
import { View, Text, Button, Image, FlatList, TextInput, StyleSheet, TouchableOpacity } from 'react-native';
import { launchCamera } from 'react-native-image-picker';
import AsyncStorage from '@react-native-async-storage/async-storage';


// श्रेणियाँ और होलिस्टिक उपचार
const CATEGORIES = [
{ name: "त्वचा", remedies: ["धीरे-धीरे साबुन से धोएँ", "एलो वेरा जेल लगाएँ", "खरोंचें नहीं"] },
{ name: "कीड़ा काटना", remedies: ["पानी से साफ करें", "शहद या एलो लगाएँ", "ठंडा पैक लगाएँ"] },
{ name: "चोट/घाव", remedies: ["शुरुआत में ठंडा पैक", "प्रभावित हिस्से को ऊँचा रखें", "48 घंटे बाद हल्का मसाज"] },
{ name: "परजीवी", remedies: ["स्वच्छता बनाए रखें", "पानी उबालकर पिएँ", "फाइबर युक्त भोजन खाएँ"] },
{ name: "अन्य", remedies: ["साफ़-सफाई रखें", "परिवर्तन देखें", "बुरा होने पर डॉक्टर से संपर्क करें"] },
];

export default function App() {
const [photoData, setPhotoData] = useState([]);
const [description, setDescription] = useState('');
const [selectedCategory, setSelectedCategory] = useState(CATEGORIES[0].name);
const [currentPhoto, setCurrentPhoto] = useState(null);

useEffect(() => { loadData(); }, []);

const loadData = async () => {
try {
const data = await AsyncStorage.getItem('photos');
if (data !== null) setPhotoData(JSON.parse(data));
} catch (error) { console.log(error); }
};

const saveData = async (newData) => {
try { await AsyncStorage.setItem('photos', JSON.stringify(newData)); }
catch (error) { console.log(error); }
};

const takePhoto = () => {
launchCamera({ mediaType: 'photo', quality: 0.5 }, response => {
if (response.assets && response.assets.length > 0) {
setCurrentPhoto(response.assets[0].uri);
}
});
};

const savePhoto = () => {
if (!currentPhoto) return;
const categoryObj = CATEGORIES.find(cat => cat.name === selectedCategory) || { remedies: [] };
const newEntry = {
uri: currentPhoto,
category: selectedCategory,
description,
remedies: categoryObj.remedies,
timestamp: new Date().toISOString()
};
const updatedData = [newEntry, ...photoData];
setPhotoData(updatedData);
saveData(updatedData);
setCurrentPhoto(null);
setDescription('');
};

return (
<View style={styles.container}>
<Text style={styles.header}>होलिस्टिक हेल्थ स्नैप</Text>
<Button onPress={takePhoto} />
{currentPhoto && (
<View style={styles.preview}>
<Image source={{ uri: currentPhoto }} style={styles.image} />
<TextInput value={description} onChangeText={setDescription} style={styles.input} />
<View style={styles.categories}>
{CATEGORIES.map(cat => (
<TouchableOpacity
key={cat.name}
onPress={() => setSelectedCategory(cat.name)}
style={[styles.categoryButton, selectedCategory === cat.name && styles.selectedCategory]}
>
<Text>{cat.name}</Text>
</TouchableOpacity>
))}
</View>
<Button onPress={savePhoto} />
</View>
)}
<Text style={styles.subHeader}>सहेजी गई तस्वीरें और उपचार:</Text>
<FlatList
data={photoData}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item }) => (
<View style={styles.item}>
<Image source={{ uri: item.uri }} style={styles.thumbnail} />
<View style={{ flex: 1, marginLeft: 10 }}>
<Text style={styles.itemText}>श्रेणी: {item.category}</Text>
<Text style={styles.itemText}>विवरण: {item.description || "N/A"}</Text>
<Text style={styles.itemText}>तारीख: {new Date(item.timestamp).toLocaleString()}</Text>
<Text style={styles.itemTextBold}>होलिस्टिक उपचार:</Text>
{item.remedies.map((remedy, i) => <Text key={i} style={styles.itemText}>• {remedy}</Text>)}
</View>
</View>
)}
/>
</View>
);
}

const styles = StyleSheet.create({
container: { flex: 1, padding: 20, backgroundColor: '#f5f5f5' },
header: { fontSize: 28, fontWeight: 'bold', marginBottom: 10 },
subHeader: { fontSize: 20, marginTop: 20, marginBottom: 10 },
preview: { marginVertical: 10 },
image: { width: '100%', height: 200, marginBottom: 10 },
input: { borderColor: '#ccc', borderWidth: 1, padding: 8, marginBottom: 10, borderRadius: 5 },
categories: { flexDirection: 'row', flexWrap: 'wrap', marginBottom: 10 },
categoryButton: { padding: 8, borderWidth: 1, borderColor: '#ccc', borderRadius: 5, marginRight: 5, marginBottom: 5 },
selectedCategory: { backgroundColor: '#a0e1e5' },
item: { flexDirection: 'row', marginBottom: 10, backgroundColor: '#fff', padding: 10, borderRadius: 5 },
thumbnail: { width: 80, height: 80, borderRadius: 5 },
itemText: { fontSize: 14 },
itemTextBold: { fontSize: 16, fontWeight: 'bold', marginTop: 5 }
});

Bạn đang đọc truyện trên: ZingTruyen.Xyz