import os
import json
import logging
import typing as t
import gradio as gr
from huggingface_hub import InferenceClient
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
)
logger = logging.getLogger(__name__)
HF_API_TOKEN = os.getenv("HF_API_TOKEN")
MODEL_REPO_ID= "google/gemma-2-9b-it"
if HF_API_TOKEN is None:
logger.error("HF_API_TOKEN environment variable is not set.")
raise ValueError("Error: HF_API_TOKEN environment variable is not set.")
def build_messages(input_json: str) -> t.Sequence[t.Mapping[str, str]]:
data_structure = (
"You are given a restaurant menu in Spanish. You MUST return a single valid JSON in this format:\n"
"Menu Format:\n"
"