Krithikesh77 commited on
Commit
2cb3d78
·
verified ·
1 Parent(s): 41f0533

Upload 4 files

Browse files
Files changed (4) hide show
  1. Lang_chain.py +13 -0
  2. app.py +39 -0
  3. branding.json +26 -0
  4. requirements.txt +5 -0
Lang_chain.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_google_genai import ChatGoogleGenerativeAI
2
+ from dotenv import load_dotenv
3
+ import os
4
+ load_dotenv()
5
+ api_key=os.getenv("GOOGLE_API_KEY")
6
+ model="gemini-2.5-flash"
7
+ def hello_langchain(prompt, history):
8
+ llm = ChatGoogleGenerativeAI(api_key=api_key, model=model)
9
+ response = llm.invoke(prompt)
10
+ return response.content
11
+
12
+ if __name__=="__main__":
13
+ print(hello_langchain("Hello"))
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from Lang_chain import hello_langchain
3
+ import json
4
+ import os
5
+
6
+ # Load branding info
7
+ branding_path = os.path.join(os.path.dirname(__file__), 'branding.json')
8
+ with open(os.path.abspath(branding_path), "r") as f:
9
+ brand_info = json.load(f)["brand"]
10
+
11
+ # Create the Gradio interface
12
+ with gr.Blocks(title=brand_info["organizationName"]) as demo:
13
+ # Branding logo at top
14
+ gr.HTML(f'''
15
+ <div style="display: flex; justify-content: center; margin-bottom: 20px;">
16
+ <img src="{brand_info["logo"]["title"]}" alt="{brand_info["organizationName"]} Logo" style="height: 100px;">
17
+ </div>
18
+ ''')
19
+
20
+ # Chat interface
21
+ gr.ChatInterface(
22
+ fn= hello_langchain,
23
+ title=brand_info["organizationName"],
24
+ description=brand_info["slogan"],
25
+ examples=[
26
+ ["What is AI?"],
27
+ ["Can you explain machine learning!"],
28
+ ["How does a neural network work?"],
29
+ ["What is natural language processing?"],
30
+ ["Tell me about computer vision."]
31
+ ],
32
+ chatbot=gr.Chatbot(type="messages"),
33
+ type="messages" # <== This line silences the warning
34
+ )
35
+
36
+
37
+
38
+ # Optional if running via `python ui.py`
39
+ demo.launch()
branding.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "brand":
3
+ {
4
+ "organizationName": "HERE AND NOW AI",
5
+ "website": "https://hereandnowai.com",
6
+ "email": "[email protected]",
7
+ "mobile": "+91 996 296 1000",
8
+ "slogan": "designed with passion for innovation",
9
+ "colors": {"primary": "#FFDF00", "secondary": "#004040"},
10
+ "logo":
11
+ {
12
+ "title": "https://raw.githubusercontent.com/hereandnowai/images/refs/heads/main/logos/logo-of-here-and-now-ai.png",
13
+ "favicon": "https://raw.githubusercontent.com/hereandnowai/images/refs/heads/main/logos/favicon-logo-with-name.png"}, "chatbot": {"avatar": "https://raw.githubusercontent.com/hereandnowai/images/refs/heads/main/logos/caramel.jpeg", "face": "https://raw.githubusercontent.com/hereandnowai/images/refs/heads/main/logos/caramel-face.jpeg"
14
+ },
15
+
16
+ "socialMedia":
17
+ {
18
+ "blog": "https://hereandnowai.com/blog",
19
+ "linkedin": "https://www.linkedin.com/company/hereandnowai/",
20
+ "instagram": "https://instagram.com/hereandnow_ai",
21
+ "github": "https://github.com/hereandnowai",
22
+ "x": "https://x.com/hereandnow_ai",
23
+ "youtube": "https://youtube.com/@hereandnow_ai"
24
+ }
25
+ }
26
+ }
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio
2
+ langchain
3
+ langchain-google-genai
4
+ dotenv
5
+