International Rice Research Institute commited on
Commit
bef5912
·
verified ·
1 Parent(s): 030fd00

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +14 -3
app.R CHANGED
@@ -54,12 +54,18 @@ HF_API_TOKEN <- token
54
  # hf_model <- "google/gemma-2b-it"
55
 
56
  # Option 4: HuggingFaceH4/zephyr-7b-beta (very reliable)
57
- hf_model <- "HuggingFaceH4/zephyr-7b-beta"
 
 
 
 
58
 
59
  #HF_API_URL <- paste0("https://api-inference.huggingface.co/models/", hf_model)
 
60
  HF_API_URL <- paste0("https://router.huggingface.co/hf-inference/models/", hf_model)
61
 
62
 
 
63
  # Function to test API connection
64
  test_api_connection <- function() {
65
  if (!token_exists) {
@@ -112,15 +118,20 @@ if (token_exists && api_test$success) {
112
  "microsoft/phi-2",
113
  "google/gemma-2b-it",
114
  "HuggingFaceH4/zephyr-7b-beta"
 
 
 
 
115
  )
116
-
117
  for (alt_model in alt_models) {
118
  if (alt_model == hf_model) next
119
 
120
  print(paste("Trying alternative model:", alt_model))
121
  test_url <- paste0("https://router.huggingface.co/hf-inference/models/", alt_model)
122
  # url <- paste0("https://router.huggingface.co/hf-inference/models/", model)
123
-
 
124
  tryCatch({
125
  response <- POST(
126
  url = test_url,
 
54
  # hf_model <- "google/gemma-2b-it"
55
 
56
  # Option 4: HuggingFaceH4/zephyr-7b-beta (very reliable)
57
+ hf_model <- "mistralai/Mistral-7B-Instruct-v0.2"
58
+ #"HuggingFaceH4/zephyr-7b-beta", # Most reliable
59
+ # "mistralai/Mistral-7B-Instruct-v0.2", # Also good
60
+ # "microsoft/phi-2", # Small but works
61
+ # "google/flan-t5-large"
62
 
63
  #HF_API_URL <- paste0("https://api-inference.huggingface.co/models/", hf_model)
64
+ #HF_API_URL <- paste0("https://router.huggingface.co/hf-inference/models/", hf_model)
65
  HF_API_URL <- paste0("https://router.huggingface.co/hf-inference/models/", hf_model)
66
 
67
 
68
+
69
  # Function to test API connection
70
  test_api_connection <- function() {
71
  if (!token_exists) {
 
118
  "microsoft/phi-2",
119
  "google/gemma-2b-it",
120
  "HuggingFaceH4/zephyr-7b-beta"
121
+ "HuggingFaceH4/zephyr-7b-beta", # Most reliable
122
+ "mistralai/Mistral-7B-Instruct-v0.2", # Also good
123
+ "microsoft/phi-2", # Small but works
124
+ "google/flan-t5-large"
125
  )
126
+ ############################
127
  for (alt_model in alt_models) {
128
  if (alt_model == hf_model) next
129
 
130
  print(paste("Trying alternative model:", alt_model))
131
  test_url <- paste0("https://router.huggingface.co/hf-inference/models/", alt_model)
132
  # url <- paste0("https://router.huggingface.co/hf-inference/models/", model)
133
+ url <- paste0("https://router.huggingface.co/hf-inference/models/", model)
134
+
135
  tryCatch({
136
  response <- POST(
137
  url = test_url,