Spaces:
Build error
Build error
Update app.py
Browse files90 unmodified lines91929394959697989910010110210310410510610710810990 unmodified lines# Initialize the InferenceClient with your tokenllm_client = InferenceClient(model=repo_id,token=api_token[:-2], # Pass the token heretimeout=120,)# Function to call the LLMdef call_llm(inference_client: InferenceClient, prompt: str):response = inference_client.post(json={"inputs": prompt,"parameters": {"max_new_tokens": 500}},)return json.loads(response.decode())[0]["generated_text"]# Use the prediction to generate nutrition information# prompt = f"Nutrition information (Calories, Protein, Carbohydrates, Dietary Fiber, Sugars, Fat, Sodium, Potassium, Vitamin C, Vitamin B6, Folate, Niacin, Pantothenic acid) for {prediction} in formatted list"90 unmodified lines91929394959697989910010110210310410510610790 unmodified lines# Initialize the InferenceClient with your tokenllm_client = InferenceClient(model=repo_id,token=api_token,timeout=120,)# Function to call the LLMdef call_llm(inference_client: InferenceClient, prompt: str):response = inference_client.text_generation(prompt=prompt,max_new_tokens=500,temperature=0.7, # optional)return response# Use the prediction to generate nutrition information# prompt = f"Nutrition information (Calories, Protein, Carbohydrates, Dietary Fiber, Sugars, Fat, Sodium, Potassium, Vitamin C, Vitamin B6, Folate, Niacin, Pantothenic acid) for {prediction} in formatted list"
app.py+6-8