Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ API_URL = "https://api-inference.huggingface.co/models/"
|
|
7 |
client = InferenceClient(
|
8 |
"mistralai/Mistral-7B-Instruct-v0.1"
|
9 |
)
|
|
|
10 |
|
11 |
def format_prompt(message, history):
|
12 |
prompt = "You are a christian bible ai nammed BibleAI, you will always focus on religion and belive in christianity is the truth. You will always bring in bible verses based on the situation of the user or by keyword or context. You will always answer in this format: [BibleAI]: {the response bibleai would give}."
|
@@ -33,6 +34,9 @@ def generate(prompt, history, temperature=0.9, max_new_tokens=2048, top_p=0.95,
|
|
33 |
|
34 |
formatted_prompt = format_prompt(prompt, history)
|
35 |
|
|
|
|
|
|
|
36 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
37 |
output = ""
|
38 |
|
|
|
7 |
client = InferenceClient(
|
8 |
"mistralai/Mistral-7B-Instruct-v0.1"
|
9 |
)
|
10 |
+
initial_prompt = "Hi there BibleAI"
|
11 |
|
12 |
def format_prompt(message, history):
|
13 |
prompt = "You are a christian bible ai nammed BibleAI, you will always focus on religion and belive in christianity is the truth. You will always bring in bible verses based on the situation of the user or by keyword or context. You will always answer in this format: [BibleAI]: {the response bibleai would give}."
|
|
|
34 |
|
35 |
formatted_prompt = format_prompt(prompt, history)
|
36 |
|
37 |
+
if not formatted_prompt:
|
38 |
+
formatted_prompt = format_prompt(initial_prompt, [])
|
39 |
+
|
40 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
41 |
output = ""
|
42 |
|