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 |
initial_prompt = "Hi there BibleAI"
|
11 |
|
12 |
def format_prompt(message, history):
|
@@ -34,9 +35,6 @@ def generate(prompt, history, temperature=0.9, max_new_tokens=2048, top_p=0.95,
|
|
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 |
|
@@ -95,6 +93,7 @@ customCSS = """
|
|
95 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
96 |
gr.ChatInterface(
|
97 |
generate,
|
|
|
98 |
additional_inputs=additional_inputs,
|
99 |
)
|
100 |
|
|
|
7 |
client = InferenceClient(
|
8 |
"mistralai/Mistral-7B-Instruct-v0.1"
|
9 |
)
|
10 |
+
|
11 |
initial_prompt = "Hi there BibleAI"
|
12 |
|
13 |
def format_prompt(message, history):
|
|
|
35 |
|
36 |
formatted_prompt = format_prompt(prompt, history)
|
37 |
|
|
|
|
|
|
|
38 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
39 |
output = ""
|
40 |
|
|
|
93 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
94 |
gr.ChatInterface(
|
95 |
generate,
|
96 |
+
inputs=[gr.Textbox("User", default=initial_prompt)],
|
97 |
additional_inputs=additional_inputs,
|
98 |
)
|
99 |
|