Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
from transformers.pipelines import pipeline
|
| 4 |
-
from
|
| 5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 6 |
-
from
|
| 7 |
-
from
|
| 8 |
from langchain.chains import RetrievalQA
|
| 9 |
from langchain_community.llms import HuggingFacePipeline
|
| 10 |
|
|
@@ -51,7 +51,7 @@ C. General statistics
|
|
| 51 |
Question: "{question}"
|
| 52 |
Answer with only A, B, or C.
|
| 53 |
"""
|
| 54 |
-
result = llm_pipeline(routing_prompt,
|
| 55 |
route = result[0]['generated_text'].strip().upper()
|
| 56 |
if route.startswith("A"):
|
| 57 |
return "stat6371"
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
from transformers.pipelines import pipeline
|
| 4 |
+
from langchain_community.document_loaders import PyPDFLoader
|
| 5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 6 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
| 7 |
+
from langchain_community.vectorstores import FAISS
|
| 8 |
from langchain.chains import RetrievalQA
|
| 9 |
from langchain_community.llms import HuggingFacePipeline
|
| 10 |
|
|
|
|
| 51 |
Question: "{question}"
|
| 52 |
Answer with only A, B, or C.
|
| 53 |
"""
|
| 54 |
+
result = llm_pipeline(routing_prompt, max_new_tokens=30, do_sample=False)
|
| 55 |
route = result[0]['generated_text'].strip().upper()
|
| 56 |
if route.startswith("A"):
|
| 57 |
return "stat6371"
|