alexkueck commited on
Commit
d0b0ea1
1 Parent(s): 65d6ec0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -22,7 +22,15 @@ client = InferenceClient("https://api-inference.huggingface.co/models/meta-llama
22
 
23
  # generate function
24
  def generate(text, history):
25
- payload = tokenizer.apply_chat_template([{"role":"user","content":text}],tokenize=False)
 
 
 
 
 
 
 
 
26
  res = client.text_generation(
27
  payload,
28
  do_sample=True,
 
22
 
23
  # generate function
24
  def generate(text, history):
25
+ #mit RAG
26
+ #später entsprechend mit Vektorstore...
27
+ context="Nuremberg is the second-largest city of the German state of Bavaria after its capital Munich, and its 541,000 inhabitants make it the 14th-largest city in Germany. On the Pegnitz River (from its confluence with the Rednitz in Fürth onwards: Regnitz, a tributary of the River Main) and the Rhine–Main–Danube Canal, it lies in the Bavarian administrative region of Middle Franconia, and is the largest city and the unofficial capital of Franconia. Nuremberg forms with the neighbouring cities of Fürth, Erlangen and Schwabach a continuous conurbation with a total population of 812,248 (2022), which is the heart of the urban area region with around 1.4 million inhabitants,[4] while the larger Nuremberg Metropolitan Region has approximately 3.6 million inhabitants. The city lies about 170 kilometres (110 mi) north of Munich. It is the largest city in the East Franconian dialect area."
28
+
29
+ prompt = f"""Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
30
+ {context} Question: {question}"""
31
+
32
+ #zusammengesetzte Anfrage an Modell...
33
+ payload = tokenizer.apply_chat_template([{"role":"user","content":prompt}],tokenize=False)
34
  res = client.text_generation(
35
  payload,
36
  do_sample=True,