Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +28 -0
- branding.json +26 -0
- requirements.txt +8 -0
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
import os
|
| 4 |
+
import gradio as gr
|
| 5 |
+
|
| 6 |
+
# Load environment variables
|
| 7 |
+
load_dotenv()
|
| 8 |
+
api_key = os.getenv("GOOGLE_API_KEY")
|
| 9 |
+
model = "gemini-2.5-flash"
|
| 10 |
+
|
| 11 |
+
# Define function to call Gemini model
|
| 12 |
+
def hello_langchain(prompt):
|
| 13 |
+
llm = ChatGoogleGenerativeAI(api_key=api_key, model=model)
|
| 14 |
+
response = llm.invoke(prompt)
|
| 15 |
+
return response.content
|
| 16 |
+
|
| 17 |
+
# Gradio UI setup
|
| 18 |
+
interface = gr.Interface(
|
| 19 |
+
fn=hello_langchain,
|
| 20 |
+
inputs=gr.Textbox(lines=3, placeholder="Enter your prompt here..."),
|
| 21 |
+
outputs="text",
|
| 22 |
+
title="Gemini Chat with LangChain",
|
| 23 |
+
description="Enter a prompt to get a response from Gemini 2.5 Flash using LangChain."
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Launch the UI
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
interface.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": "info@hereandnowai.com",
|
| 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,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
OpenAI
|
| 2 |
+
dotenv
|
| 3 |
+
gradio
|
| 4 |
+
requests
|
| 5 |
+
PyPDF2
|
| 6 |
+
langchain_google_genai
|
| 7 |
+
langchain_community
|
| 8 |
+
bs4
|