File size: 2,755 Bytes
b7f9508
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import streamlit as st
from firebase_admin import firestore

import pdd1

def app():
    
    if 'db' not in st.session_state:
        st.session_state.db = ''

    db=firestore.client()
    st.session_state.db=db
    # st.title('  :violet[pdd]  :sunglasses:')
    
    ph = ''
    if st.session_state.username=='':
        st.subheader('Login to use Model')
    else:
        pdd1.app()

# import streamlit as st

#def app():
     #st.markdown('<a href="https://prj2106-plantd.hf.space/">Go to Another Link</a>', unsafe_allow_html=True)
# import streamlit as st
# import tensorflow as tf
# from PIL import Image
# import numpy as np
# import os

# import io


# import google.generativeai as genai

# def app():
#     def import_and_predict(image_data, model, class_labels):
#         size = (256, 256)

#         if image_data is not None:
#             image = Image.open(io.BytesIO(image_data.read()))
#             image = image.resize(size)
#             image = np.array(image)
#             img_reshape = image / 255.0
#             img_reshape = np.expand_dims(img_reshape, axis=0)

#             prediction = model.predict(img_reshape)
#             st.image(image, width=300)
#             predictions_label = class_labels[np.argmax(prediction[0])]
#             return predictions_label
#         else:
#             st.warning("Please upload an image.")
#             return None


#     def get_info_from_gemini(prompt):
#         genai.configure(api_key=os.environ.get('gemini_api'))
#         model = genai.GenerativeModel('gemini-pro')
#         response = model.generate_content(f"{prompt}")
#         return response




#     st.title("Plant Disease Detection")

#     uploaded_image = st.file_uploader(f"Upload an image", type=["jpg", "jpeg", "png"])
#     models_path = ['./best_model_100_subset.h5',]



#     CLASS_LABELS = ['Tomato Early blight', 'Tomato Leaf Mold', 'Tomato YellowLeaf Curl Virus',
#                                     'Tomato mosaic virus', 'Tomato healthy']
                    
#     model = tf.keras.models.load_model(models_path[0])




#     prediction = import_and_predict(uploaded_image, model, CLASS_LABELS)
#     st.write("disease name: ", prediction)


#     if prediction != None:
#                 new_title = '<p style="font-size: 38px">Measures you can take to control: </p>'
#                 st.markdown(new_title, unsafe_allow_html=True)
#                 if prediction == CLASS_LABELS[4]:
#                     st.write("Plant is healthy take good care of it")
#                 response = get_info_from_gemini(f"cure for the disease {prediction} tell in bulletpoints and estimated cost in inr at last give summary of each measures estimated cost")
#                 st.write(response.text)