ZennethKenneth commited on
Commit
19f7db6
·
verified ·
1 Parent(s): 92b2ac4

modify instantiation

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- client = InferenceClient("EleutherAI/gpt-neo-125M")
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 = client(prompt, max_length=max_tokens, temperature=temperature, top_p=top_p, do_sample=True)[0]['generated_text']
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()