Download R/config.R from fmegahed/decisions: direct link, hf CLI and curl.
- Browser
- Download file 3.22 kB
-
https://huggingface.co/spaces/fmegahed/decisions/resolve/main/R/config.R
- Command line
-
hf download hf://spaces/fmegahed/decisions/R/config.R
-
curl -L -o config.R https://huggingface.co/spaces/fmegahed/decisions/resolve/main/R/config.R
3.22 kB
| # Configuration: the single place for the model id, the limits and the links. | |
| # Everything a user reads about the model or the limits comes from these | |
| # values (see app_config() at the end), so the text cannot drift from the | |
| # behaviour. | |
| # Version of this app | |
| APP_VERSION <- "1.0.3" | |
| APP_DATE <- "9 November 2026" | |
| # Model used for every call. This is the ONLY place a model id may be written | |
| # (tests/testthat/test-config.R enforces this). | |
| MODEL <- "jev-1.14.0" | |
| # Day of the saved runs of the two samples (their answers record MODEL) | |
| SAVED_RUN_DATE <- "2026-10-23" | |
| # Where the decisions package of the app comes from (the Dockerfile installs | |
| # 0.1.0 from CRAN), and the install line that the code, the bundle and Help give | |
| DECISIONS_SOURCE <- "CRAN" | |
| DECISIONS_INSTALL <- 'install.packages("decisions")' | |
| # Price in USD for each input token (USD 0.042 for each million tokens) | |
| PRICE_PER_TOKEN <- 0.042 / 1e6 | |
| # Spending limits in USD (all days and months are in UTC) | |
| LIMIT_SESSION <- 0.25 | |
| LIMIT_DAY <- 2 | |
| LIMIT_MONTH <- 20 | |
| # Token guesses for the cost check before the first call | |
| TOKENS_GUESS <- c(image = 16000, text = 1000) | |
| # Input limits | |
| MAX_FILE_MB <- 5 | |
| MAX_ZIP_MB <- 50 | |
| MAX_IMAGES <- 100 | |
| MAX_TEXTS <- 200 | |
| MAX_TEXT_CHARS <- 4000 | |
| MAX_INSTRUCTIONS <- 500 | |
| MAX_DESCRIPTION <- 300 | |
| # Number of answers for a choice question and of levels for a score question | |
| ANSWER_RANGE <- list(choice = c(2, 6), score = c(2, 5)) | |
| # The question of a new session: a choice of two answers, as the Add answer button names them | |
| START_QUESTION <- list( | |
| type = "choice", instructions = "", answers = c(`answer 1` = "", `answer 2` = "") | |
| ) | |
| # Reference images for each answer, and inputs for each call to Jev | |
| MAX_REFERENCES <- 2 | |
| CHUNK_SIZE <- 10 | |
| # Image settings that decisions applies before it sends an image | |
| IMAGE_SETTINGS <- list(max_size = 768, upscale = TRUE, crop = "none") | |
| # Names of the environment variables (the values are never in the code) | |
| KEY_VAR <- "HF_JEV_API" | |
| USAGE_TOKEN_VAR <- "HF_USAGE_TOKEN" | |
| # Private dataset that stores the usage, and the public status file | |
| USAGE_REPO <- "fmegahed/decisions-space-usage" | |
| STATUS_URL <- "https://raw.githubusercontent.com/fmegahed/decisions-space/main/status/status.csv" | |
| # Address of the Space, and the help video on YouTube ("" hides its buttons) | |
| # with its length in whole minutes (the video runs 4:59) | |
| SPACE_HOST <- "https://fmegahed-decisions.hf.space" | |
| VIDEO_URL <- "https://youtu.be/4WE-ykXzK1g" | |
| VIDEO_MINUTES <- 5 | |
| # The values that the help text uses, in one named list | |
| app_config <- function() { | |
| list( | |
| version = APP_VERSION, date = APP_DATE, model = MODEL, | |
| price_per_million = PRICE_PER_TOKEN * 1e6, | |
| limit_session = LIMIT_SESSION, limit_day = LIMIT_DAY, | |
| limit_month = LIMIT_MONTH, tokens_guess = TOKENS_GUESS, | |
| max_file_mb = MAX_FILE_MB, max_zip_mb = MAX_ZIP_MB, | |
| max_images = MAX_IMAGES, max_texts = MAX_TEXTS, | |
| max_text_chars = MAX_TEXT_CHARS, max_instructions = MAX_INSTRUCTIONS, | |
| max_description = MAX_DESCRIPTION, answer_range = ANSWER_RANGE, | |
| max_references = MAX_REFERENCES, chunk_size = CHUNK_SIZE, | |
| image_settings = IMAGE_SETTINGS, space_host = SPACE_HOST, | |
| video_url = video_url(), video_minutes = VIDEO_MINUTES | |
| ) | |
| } | |