Spaces:
Sleeping
Sleeping
ZennethKenneth
commited on
modify instantiation
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
6 |
"""
|
7 |
# requires space hardware update to use large models (TODO)
|
8 |
# client = InferenceClient("mistralai/Mistral-Large-Instruct-2407")
|
9 |
-
|
10 |
-
|
11 |
|
12 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
13 |
# Construct the prompt with system message, history, and user input
|
@@ -15,7 +15,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
15 |
prompt += f"\nUser: {message}\nAssistant:"
|
16 |
|
17 |
# Generate a response using the model
|
18 |
-
response =
|
19 |
|
20 |
# Extract the assistant's response part (after "Assistant:")
|
21 |
assistant_response = response.split("Assistant:", 1)[-1].strip()
|
|
|
6 |
"""
|
7 |
# requires space hardware update to use large models (TODO)
|
8 |
# client = InferenceClient("mistralai/Mistral-Large-Instruct-2407")
|
9 |
+
# Note change in instatiation***
|
10 |
+
text_generator = pipeline("text-generation", model="EleutherAI/gpt-neo-125M")
|
11 |
|
12 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
13 |
# Construct the prompt with system message, history, and user input
|
|
|
15 |
prompt += f"\nUser: {message}\nAssistant:"
|
16 |
|
17 |
# Generate a response using the model
|
18 |
+
response = text_generator(prompt, max_length=max_tokens, temperature=temperature, top_p=top_p, do_sample=True)
|
19 |
|
20 |
# Extract the assistant's response part (after "Assistant:")
|
21 |
assistant_response = response.split("Assistant:", 1)[-1].strip()
|