Spaces:
Runtime error
Runtime error
Commit ·
da6a822
1
Parent(s): e94536c
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,14 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
| 5 |
from uuid import uuid4
|
| 6 |
import google.generativeai as genai
|
| 7 |
import re
|
|
|
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Necessary imports for Gradio
|
| 11 |
|
|
@@ -35,7 +42,7 @@ def upload_pdf(file_path):
|
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
def get_Answer(query):
|
| 41 |
res = collection.query( # Assuming `collection` is defined elsewhere
|
|
|
|
| 5 |
from uuid import uuid4
|
| 6 |
import google.generativeai as genai
|
| 7 |
import re
|
| 8 |
+
import os
|
| 9 |
|
| 10 |
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 11 |
+
|
| 12 |
+
# Now you can use hugging_face_api_key in your code
|
| 13 |
+
|
| 14 |
+
genai.configure(api_key=GOOGLE_API_KEY)
|
| 15 |
+
model = genai.GenerativeModel('gemini-pro') # Load the model
|
| 16 |
|
| 17 |
# Necessary imports for Gradio
|
| 18 |
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
+
|
| 46 |
|
| 47 |
def get_Answer(query):
|
| 48 |
res = collection.query( # Assuming `collection` is defined elsewhere
|