jost commited on
Commit
df56e64
1 Parent(s): c33bfd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -1,10 +1,16 @@
 
 
1
  from openai import OpenAI
2
  import gradio as gr
3
  import time
4
 
5
  anyscale_base_url = "https://api.endpoints.anyscale.com/v1"
 
6
 
7
  def predict(api_key, user_input):
 
 
 
8
  prompt = f"""[INST] {user_input} [/INST]"""
9
 
10
  client = OpenAI(base_url=anyscale_base_url, api_key=api_key)
 
1
+ from chromadb.utils import embedding_functions
2
+ import chromadb
3
  from openai import OpenAI
4
  import gradio as gr
5
  import time
6
 
7
  anyscale_base_url = "https://api.endpoints.anyscale.com/v1"
8
+ multilingual_embeddings = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="jost/multilingual-e5-base-politics-de")
9
 
10
  def predict(api_key, user_input):
11
+ client = chromadb.PersistentClient(path="./manifesto-database")
12
+ manifesto_collection = client.get_or_create_collection(name="manifesto-database", embedding_function=multilingual_embeddings)
13
+
14
  prompt = f"""[INST] {user_input} [/INST]"""
15
 
16
  client = OpenAI(base_url=anyscale_base_url, api_key=api_key)