acecalisto3 commited on
Commit
f5516d4
1 Parent(s): 06d0c93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -108,7 +108,7 @@ def run_llm(
108
  )
109
  if VERBOSE:
110
  logging.info(LOG_RESPONSE.format(resp=resp))
111
- return resp
112
 
113
 
114
  def generate(
@@ -130,19 +130,16 @@ def generate(
130
  if VERBOSE:
131
  logging.info(LOG_PROMPT.format(content=content))
132
  client = InferenceClient(model=MODEL_NAME, token=API_KEY)
133
- stream = client.text_generation(
134
  content,
135
- stream=True,
136
- details=True,
137
- return_full_text=False,
138
  temperature=temperature,
139
  top_p=top_p,
140
  repetition_penalty=repetition_penalty,
141
- max_new_tokens=max_new_tokens,
142
  )
143
- response = "".join(chunk.text for chunk in stream)
144
- return response
145
-
146
 
147
  def main():
148
  """Main function to launch the Gradio interface."""
 
108
  )
109
  if VERBOSE:
110
  logging.info(LOG_RESPONSE.format(resp=resp))
111
+ return resp.text # Access the text attribute of the response
112
 
113
 
114
  def generate(
 
130
  if VERBOSE:
131
  logging.info(LOG_PROMPT.format(content=content))
132
  client = InferenceClient(model=MODEL_NAME, token=API_KEY)
133
+ response = client.text_generation(
134
  content,
135
+ max_new_tokens=max_new_tokens,
 
 
136
  temperature=temperature,
137
  top_p=top_p,
138
  repetition_penalty=repetition_penalty,
 
139
  )
140
+ if VERBOSE:
141
+ logging.info(LOG_RESPONSE.format(resp=response))
142
+ return response.text
143
 
144
  def main():
145
  """Main function to launch the Gradio interface."""