Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import PyPDF2
|
| 3 |
-
|
| 4 |
from secret1 import GOOGLE_API as google_api
|
| 5 |
from langchain.llms import GooglePalm
|
| 6 |
from langchain.embeddings import HuggingFaceInstructEmbeddings
|
|
@@ -9,7 +9,7 @@ from langchain.embeddings import GooglePalmEmbeddings
|
|
| 9 |
from langchain.vectorstores import FAISS
|
| 10 |
from langchain.document_loaders import PyPDFLoader
|
| 11 |
from langchain.chains import RetrievalQA
|
| 12 |
-
from google import
|
| 13 |
# Define chatbot response function
|
| 14 |
def chatbot_response(user_input):
|
| 15 |
# Example: returning a placeholder response, update with actual chatbot logic
|
|
@@ -55,7 +55,7 @@ def text_extract(file):
|
|
| 55 |
# print("FitBot:",result1['result'])
|
| 56 |
# Split extracted text into chunks
|
| 57 |
# result = helper(text_splitter) # Call helper to process text chunks
|
| 58 |
-
client = genai.Client(api_key="AIzaSyBaY8zx4ak0t4TkBp28lL2hLqREzlN_Mb0")
|
| 59 |
response = client.models.generate_content(
|
| 60 |
model="gemini-2.0-flash", contents=f"you will be given the input data you have to answer the question according to the user input : {text}"
|
| 61 |
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import PyPDF2
|
| 3 |
+
pip install google-genai
|
| 4 |
from secret1 import GOOGLE_API as google_api
|
| 5 |
from langchain.llms import GooglePalm
|
| 6 |
from langchain.embeddings import HuggingFaceInstructEmbeddings
|
|
|
|
| 9 |
from langchain.vectorstores import FAISS
|
| 10 |
from langchain.document_loaders import PyPDFLoader
|
| 11 |
from langchain.chains import RetrievalQA
|
| 12 |
+
from google import
|
| 13 |
# Define chatbot response function
|
| 14 |
def chatbot_response(user_input):
|
| 15 |
# Example: returning a placeholder response, update with actual chatbot logic
|
|
|
|
| 55 |
# print("FitBot:",result1['result'])
|
| 56 |
# Split extracted text into chunks
|
| 57 |
# result = helper(text_splitter) # Call helper to process text chunks
|
| 58 |
+
client = genai.Client(api_key="AIzaSyBaY8zx4ak0t4TkBp28lL2hLqREzlN_Mb0",location='us-central1')
|
| 59 |
response = client.models.generate_content(
|
| 60 |
model="gemini-2.0-flash", contents=f"you will be given the input data you have to answer the question according to the user input : {text}"
|
| 61 |
)
|