Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,27 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
"""
|
5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
6 |
"""
|
7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
def fetch_response(user_input):
|
11 |
chat = ChatGroq(
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
from langchain_core.vectorstores import InMemoryVectorStore
|
4 |
+
from langchain.chains import RetrievalQA
|
5 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
6 |
+
from langchain_groq import ChatGroq
|
7 |
+
|
8 |
|
9 |
"""
|
10 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
11 |
"""
|
12 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
13 |
|
14 |
+
model_name = "llama-3.3-70b-versatile"
|
15 |
+
groq_api_key = "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"
|
16 |
+
groq_chat = ChatGroq(groq_api_key=groq_api_key, model_name=model_name)
|
17 |
+
embeddings = HuggingFaceEmbeddings(
|
18 |
+
model_name = "pkshatech/GLuCoSE-base-ja"
|
19 |
+
)
|
20 |
+
vector_store = InMemoryVectorStore.load(
|
21 |
+
"/content/sample_data/kinousei_vector_store", embeddings
|
22 |
+
)
|
23 |
+
retriever = vector_store.as_retriever(search_kwargs={"k": 4})
|
24 |
+
|
25 |
|
26 |
def fetch_response(user_input):
|
27 |
chat = ChatGroq(
|