Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_groq import ChatGroq
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
from langchain.prompts import PromptTemplate
|
5 |
+
|
6 |
+
st.title('Gen AI_Doctor')#TITLE
|
7 |
+
st.subheader("HERE YOU WILL FIND CAUSES AND TREATMENT FOR YOUR DIEASES....")
|
8 |
+
|
9 |
+
|
10 |
+
LLM=ChatGroq(temperature=0.6,
|
11 |
+
groq_api_key='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')#GEN AI MODEL
|
12 |
+
|
13 |
+
|
14 |
+
from PIL import Image
|
15 |
+
|
16 |
+
# Create a file uploader widget
|
17 |
+
uploaded_file = st.file_uploader("Choose an Reports and Images...", type=["jpg", "jpeg", "png","PDF"," DOC/DOCX", "PDF","RTF","TXT","ODT"])
|
18 |
+
|
19 |
+
# Check if a file has been uploaded
|
20 |
+
if uploaded_file is not None:
|
21 |
+
# Open the image file
|
22 |
+
image = Image.open(uploaded_file)
|
23 |
+
|
24 |
+
# Display the image
|
25 |
+
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
26 |
+
|
27 |
+
SUB=st.button('SUBMIT')#BUTTON
|
28 |
+
|
29 |
+
B=PromptTemplate(input=['image'],
|
30 |
+
template="""you are a doctor with 20 years of experience in this field, please go through the {image}uploaded image and classify to which it belongs and also tell me wheather it is effect to which disease and display it and also provide me the treatment and reasons for that disease""")
|
31 |
+
|
32 |
+
if SUB:
|
33 |
+
D=B.format(image=uploaded_file)
|
34 |
+
E=LLM.invoke(D)
|
35 |
+
st.write(E.content)
|