Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from langchain_community.document_loaders import WebBaseLoader, PyPDFLoader
|
3 |
from langchain_community.vectorstores import Chroma
|
4 |
from langchain_community import embeddings
|
@@ -8,9 +9,11 @@ from langchain_core.output_parsers import StrOutputParser
|
|
8 |
from langchain_core.prompts import ChatPromptTemplate
|
9 |
from langchain.output_parsers import PydanticOutputParser
|
10 |
from langchain.text_splitter import CharacterTextSplitter
|
|
|
11 |
|
12 |
def process_input(urls, question):
|
13 |
-
|
|
|
14 |
# Convert string of URLs to list
|
15 |
urls_list = urls.split("\n")
|
16 |
docs = [WebBaseLoader(url).load() for url in urls_list]
|
|
|
1 |
import gradio as gr
|
2 |
+
from langchain import HuggingFaceHub
|
3 |
from langchain_community.document_loaders import WebBaseLoader, PyPDFLoader
|
4 |
from langchain_community.vectorstores import Chroma
|
5 |
from langchain_community import embeddings
|
|
|
9 |
from langchain_core.prompts import ChatPromptTemplate
|
10 |
from langchain.output_parsers import PydanticOutputParser
|
11 |
from langchain.text_splitter import CharacterTextSplitter
|
12 |
+
import os
|
13 |
|
14 |
def process_input(urls, question):
|
15 |
+
os.environ['HUGGINGFACEHUB_API_TOKEN'] = 'HUGGINGFACEHUB_API_TOKEN'
|
16 |
+
model_local = HuggingFaceHub(repo_id="google/gemma-7b", model_kwargs={"temperature":0,"max_length":64})
|
17 |
# Convert string of URLs to list
|
18 |
urls_list = urls.split("\n")
|
19 |
docs = [WebBaseLoader(url).load() for url in urls_list]
|