Spaces:
Build error
Build error
Update app.py
Browse files90 unmodified lines919293949495969797981001011021031049910010110210310610410510610790 unmodified lines # Initialize the InferenceClient with your token llm_client = InferenceClient( model=repo_id, token=api_token[:-2], # Pass the token here token=api_token, timeout=120, )
# Function to call the LLM def call_llm(inference_client: InferenceClient, prompt: str): response = inference_client.post( json={ "inputs": prompt, "parameters": {"max_new_tokens": 500} }, response = inference_client.text_generation( prompt=prompt, max_new_tokens=500, temperature=0.7, # optional ) return json.loads(response.decode())[0]["generated_text"] 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