Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def format_prompt(message, history):
|
|
31 |
return prompt
|
32 |
|
33 |
def response(
|
34 |
-
prompt, history,temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
|
35 |
):
|
36 |
temperature = float(temperature)
|
37 |
if temperature < 1e-2: temperature = 1e-2
|
@@ -66,8 +66,8 @@ def response(
|
|
66 |
#print(str(prompt)+"\n\n"+str(combination))
|
67 |
if(len(results)>1):
|
68 |
addon=" Bitte berücksichtige bei deiner Antwort ausschießlich folgende Auszüge aus unserer Wahlhilfe Datenbank, sofern sie für die Antwort erforderlich sind. Beantworte die Frage knapp und präzise. Ignoriere unpassende Datenbank-Auszüge OHNE sie zu kommentieren, zu erwähnen oder aufzulisten:\n"+"\n".join(results)
|
69 |
-
system="Du heißt Avah und bist ein deutschsprachiges KI-basiertes Wahlhilfe Beratungssystem zum Wahl-O-Maten für die Bundestagswahl 2021."+addon+"\n\nUser-Anliegen:"
|
70 |
-
formatted_prompt = format_prompt(system+"\n"+prompt,history)
|
71 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
72 |
output = ""
|
73 |
for response in stream:
|
@@ -79,6 +79,8 @@ def response(
|
|
79 |
def update_prompt(selected_option, history):
|
80 |
if selected_option=="Keine These ausgewählt":
|
81 |
selected_option== " "
|
|
|
|
|
82 |
return history, selected_option
|
83 |
|
84 |
dropdown_options = ["Keine These ausgewählt",
|
|
|
31 |
return prompt
|
32 |
|
33 |
def response(
|
34 |
+
prompt, history,selected_option,temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
|
35 |
):
|
36 |
temperature = float(temperature)
|
37 |
if temperature < 1e-2: temperature = 1e-2
|
|
|
66 |
#print(str(prompt)+"\n\n"+str(combination))
|
67 |
if(len(results)>1):
|
68 |
addon=" Bitte berücksichtige bei deiner Antwort ausschießlich folgende Auszüge aus unserer Wahlhilfe Datenbank, sofern sie für die Antwort erforderlich sind. Beantworte die Frage knapp und präzise. Ignoriere unpassende Datenbank-Auszüge OHNE sie zu kommentieren, zu erwähnen oder aufzulisten:\n"+"\n".join(results)
|
69 |
+
system="Du heißt Avah und bist ein deutschsprachiges KI-basiertes Wahlhilfe Beratungssystem zum Wahl-O-Maten für die Bundestagswahl 2021. DU nimmst selber in keinem Fall eigen politische Postionen ein!"+addon+"\n\nUser-Anliegen:"
|
70 |
+
formatted_prompt = format_prompt(system + "\n" + selected_option + "\n" + prompt, history)
|
71 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
72 |
output = ""
|
73 |
for response in stream:
|
|
|
79 |
def update_prompt(selected_option, history):
|
80 |
if selected_option=="Keine These ausgewählt":
|
81 |
selected_option== " "
|
82 |
+
else:
|
83 |
+
selected_option= "Die Nutzer Frage bezieht sich auf folgende Wahl-O-Mat These: "+ selected_option
|
84 |
return history, selected_option
|
85 |
|
86 |
dropdown_options = ["Keine These ausgewählt",
|