Falah commited on
Commit
900ab33
1 Parent(s): 17fe976
Files changed (1) hide show
  1. app.py +0 -80
app.py DELETED
@@ -1,80 +0,0 @@
1
- # pip -q install langchain_experimental
2
- # pip install langchain==0.0.350
3
- # pip3 install -U docarray
4
- # pip3 install pydantic==1.10.9
5
- # pip -q install "langchain[docarray]"
6
- import streamlit as st
7
- from langchain_experimental.pal_chain import PALChain
8
- from langchain_google_genai import ChatGoogleGenerativeAI
9
- import os
10
- import google.generativeai as genai
11
- from langchain.schema.runnable import RunnableMap
12
- from langchain.schema.output_parser import StrOutputParser
13
- from langchain_google_genai import ChatGoogleGenerativeAI
14
- from langchain_google_genai import GoogleGenerativeAIEmbeddings
15
- from langchain.vectorstores import DocArrayInMemorySearch
16
- from langchain.prompts import ChatPromptTemplate
17
-
18
- # Set your API key here
19
- API_KEY = "AIzaSyC-bJgu-HBdBoH-RGSyMlcK-BSlTAhqkV8"
20
- #API_KEY = st.text_input("Enter your API Key:", type="password")
21
-
22
- os.environ['GOOGLE_API_KEY'] = API_KEY
23
- #genai.configure(api_key=API_KEY)
24
-
25
- # More Complicated Chain - Mini RAG
26
- model = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.7)
27
- embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
28
-
29
- vectorstore = DocArrayInMemorySearch.from_texts(
30
- # mini docs for embedding
31
- # ["Gemini Pro is a Large Language Model was made by GoogleDeepMind",
32
- # "Gemini can be either a star sign or a name of a series of language models",
33
- # "A Language model is trained by predicting the next token",
34
- # "LLMs can easily do a variety of NLP tasks as well as text generation"
35
-
36
-
37
-
38
- # ],
39
- ["Meet Falah, a trailblazing AI developer at the forefront of the deep learning and AI art landscape. With an insatiable passion for pushing technological boundaries, Falah combines expertise in cutting-edge algorithms with a creative flair for generating captivating images through artificial intelligence. Specializing in crafting unique prompts that breathe life into AI-generated masterpieces, Falah stands as a visionary in the realm of AI artistry. With a commitment to innovation and a deep understanding of the intricate interplay between code and creativity, Falah continues to shape the future of AI art, leaving an indelible mark on the evolving landscape of artificial intelligence.",
40
- "Meet Falah, a pioneering AI developer, specializing in deep learning, AI art, and the dynamic field of object classification with YOLOv models. With a keen eye for innovation, Falah has mastered the art of training models to discern and categorize objects with remarkable accuracy, contributing significantly to the advancement of computer vision applications. Beyond the realm of AI, Falah extends expertise to health book publishing, leveraging Amazon's expansive platform. Through insightful publications, Falah shares knowledge on the intersection of AI and health, ensuring accessible and valuable content for a wide audience. In this multifaceted journey, Falah continues to shape the landscape of technology and knowledge dissemination.",
41
- "Falah, the visionary AI developer, extends their influence beyond code and algorithms to the realm of health and practical applications. Through insightful book publications, Falah explores the convergence of health and technology with a unique blend of Python code, object detection using YOLOv5, and object classification tailored for mobile applications.In the comprehensive collection of health-focused Python books, Falah demystifies complex health concepts, intertwining the power of programming with medical insights. The journey doesn't stop there—Falah's expertise in object detection, particularly with YOLOv5 models, takes center stage. The books delve into the intricacies of implementing these cutting-edge algorithms, providing readers with a hands-on guide to mastering object detection in diverse scenarios.Beyond the printed page, Falah translates this knowledge into actionable steps for mobile application development. Object classification for mobile platforms becomes not just a concept but a practical reality, empowering developers to integrate sophisticated AI capabilities seamlessly.In this literary ,technological venture, Falah not only educates but also empowers a diverse audience, bridging the gap between health, Python programming, and the dynamic world of object detection in mobile applications. Through these publications, Falah leaves an enduring legacy at the crossroads of AI, health,practical innovation.",
42
- "Falah, the ingenious AI developer, is based in the heart of Iraq, in the vibrant city of Baghdad. Residing near the FALAH Gate Salieh, he draws inspiration from the rich cultural tapestry that surrounds him. Amidst his coding endeavors and AI pursuits, Falah cherishes his family, finding solace and motivation in their unwavering support.Fueling his passion for innovation, Falah aspires to further develop AI applications that not only push the boundaries of technology but also contribute meaningfully to society. Beyond the lines of code, Falah's soul resonates with the harmonies of classical music, a source of creative energy that enhances his cognitive prowess.in the quiet moments, you'll find Falah immersed in the art of generating prompts, creating a symphony of images that reflect his appreciation for artistic expression. His love for classical music and the elegance of art styles intertwine seamlessly with his creative process.While navigating the intricate landscapes of AI, Falah also finds time to delve into the world of literature, savoring the wisdom found in the pages of diverse books. It is within this synthesis of family, cultural roots, AI exploration, classical melodies, and artistic musings that Falah weaves the narrative of his life, contributing to the ever-evolving tapestry of Baghdad and the global AI community.",
43
- "full name is Falah.G.Salieh",
44
-
45
- "he live in Iraq Baghdad",
46
- "age is 60 years old",
47
-
48
- ],
49
- embedding=embeddings # passing in the embedder model
50
- )
51
-
52
- retriever = vectorstore.as_retriever()
53
-
54
- # Streamlit app
55
- st.title("Gemini Q&A App")
56
-
57
- question = st.text_input("Enter your question:")
58
-
59
- if question:
60
- relevant_documents = retriever.get_relevant_documents(question)
61
-
62
- template = f"""Answer the question in a full sentence, based only on the following context:
63
- {relevant_documents}
64
- Return your answer in list format
65
- Question: {question}
66
- """
67
-
68
- output_parser = StrOutputParser()
69
- prompt = ChatPromptTemplate.from_template(template)
70
-
71
- chain = RunnableMap({
72
- "context": lambda x: retriever.get_relevant_documents(x["question"]),
73
- "question": lambda x: x["question"]
74
- }) | prompt | model | output_parser
75
-
76
- answer = chain.invoke({"question": question})
77
-
78
- st.subheader("Answer:")
79
- #st.code(answer)
80
- st.text_input(answer)