Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ client = InferenceClient(
|
|
| 9 |
)
|
| 10 |
|
| 11 |
def format_prompt(message, history):
|
| 12 |
-
prompt = "You are a
|
| 13 |
for user_prompt, bot_response in history:
|
| 14 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 15 |
prompt += f" {bot_response}</s> "
|
|
@@ -43,45 +43,6 @@ def generate(prompt, history, temperature=0.9, max_new_tokens=2048, top_p=0.95,
|
|
| 43 |
return output
|
| 44 |
|
| 45 |
|
| 46 |
-
additional_inputs=[
|
| 47 |
-
gr.Slider(
|
| 48 |
-
label="Temperature",
|
| 49 |
-
value=0.9,
|
| 50 |
-
minimum=0.0,
|
| 51 |
-
maximum=1.0,
|
| 52 |
-
step=0.05,
|
| 53 |
-
interactive=True,
|
| 54 |
-
info="Higher values produce more diverse outputs",
|
| 55 |
-
),
|
| 56 |
-
gr.Slider(
|
| 57 |
-
label="Max new tokens",
|
| 58 |
-
value=2048,
|
| 59 |
-
minimum=64,
|
| 60 |
-
maximum=4096,
|
| 61 |
-
step=64,
|
| 62 |
-
interactive=True,
|
| 63 |
-
info="The maximum numbers of new tokens",
|
| 64 |
-
),
|
| 65 |
-
gr.Slider(
|
| 66 |
-
label="Top-p (nucleus sampling)",
|
| 67 |
-
value=0.90,
|
| 68 |
-
minimum=0.0,
|
| 69 |
-
maximum=1,
|
| 70 |
-
step=0.05,
|
| 71 |
-
interactive=True,
|
| 72 |
-
info="Higher values sample more low-probability tokens",
|
| 73 |
-
),
|
| 74 |
-
gr.Slider(
|
| 75 |
-
label="Repetition penalty",
|
| 76 |
-
value=1.2,
|
| 77 |
-
minimum=1.0,
|
| 78 |
-
maximum=2.0,
|
| 79 |
-
step=0.05,
|
| 80 |
-
interactive=True,
|
| 81 |
-
info="Penalize repeated tokens",
|
| 82 |
-
)
|
| 83 |
-
]
|
| 84 |
-
|
| 85 |
customCSS = """
|
| 86 |
#component-7 { # this is the default element ID of the chat component
|
| 87 |
height: 1600px; # adjust the height as needed
|
|
@@ -92,7 +53,6 @@ customCSS = """
|
|
| 92 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 93 |
gr.ChatInterface(
|
| 94 |
generate,
|
| 95 |
-
additional_inputs=additional_inputs,
|
| 96 |
)
|
| 97 |
|
| 98 |
-
demo.queue().launch(debug=True)
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
def format_prompt(message, history):
|
| 12 |
+
prompt = "You are BibleLearnerAI, a Christian Bible AI. You focus on religion, believing in Christianity as truth, and provide relevant Bible verses. When greeted, respond with a religious greeting and introduce yourself."
|
| 13 |
for user_prompt, bot_response in history:
|
| 14 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 15 |
prompt += f" {bot_response}</s> "
|
|
|
|
| 43 |
return output
|
| 44 |
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
customCSS = """
|
| 47 |
#component-7 { # this is the default element ID of the chat component
|
| 48 |
height: 1600px; # adjust the height as needed
|
|
|
|
| 53 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 54 |
gr.ChatInterface(
|
| 55 |
generate,
|
|
|
|
| 56 |
)
|
| 57 |
|
| 58 |
+
demo.queue(concurrency_count=75, max_size=100).launch(debug=True)
|