Spaces:
Sleeping
Sleeping
Update app.py
Browse files49 unmodified lines505152535455565758596061626349 unmodified linesif self.cfg["provider"] == "hf":try:# Try text-generation firstout = self.client.text_generation(model=model, prompt=prompt, max_new_tokens=128, temperature=0.2)return out.strip()except Exception as e:# If the backend says “Supported task: conversational”, retry with chatif "supported task: conversational" in str(e).lower():chat = self.client.chat_completion(model=model,messages=[{"role": "user", "content": prompt}],max_tokens=128,49 unmodified lines505152535455565758596061626349 unmodified linesif self.cfg["provider"] == "hf":try:# Try text-generation firstout = self.hf.text_generation(model=model, prompt=prompt, max_new_tokens=128, temperature=0.2)return out.strip()except Exception as e:# If the backend says “Supported task: conversational”, retry with chatif "supported task: conversational" in str(e).lower():chat = self.hf.chat_completion(model=model,messages=[{"role": "user", "content": prompt}],max_tokens=128,
app.py+2-2