wxgeorge commited on
Commit
a1c24d9
1 Parent(s): 7302e17

:sparkles: make initial model choice change day over day.

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -3,7 +3,8 @@ import gradio as gr
3
  import os
4
  import json
5
  import functools
6
-
 
7
 
8
  api_key = os.environ.get('FEATHERLESS_API_KEY')
9
  client = OpenAI(
@@ -49,9 +50,10 @@ def build_model_choices():
49
  model_choices = build_model_choices()
50
 
51
  def initial_model(referer=None):
52
- print(f"initial_model({referer})")
53
  if referer == 'http://127.0.0.1:7860/':
54
- return 'Sao10K/L3-70B-Euryale-v2.1'
 
55
  if referer and referer.startswith("https://huggingface.co/"):
56
  possible_model = referer[23:]
57
  full_model_list = functools.reduce(lambda x,y: x+y, model_cache.values(), [])
@@ -59,7 +61,10 @@ def initial_model(referer=None):
59
  if model_is_supported:
60
  return possible_model
61
 
62
- return 'anakin87/yo-Llama-3-8B-Instruct'
 
 
 
63
 
64
  title_text="HuggingFace's missing inference widget"
65
  with gr.Blocks(title_text, css='.logo-mark { fill: #ffe184; }') as demo:
 
3
  import os
4
  import json
5
  import functools
6
+ import random
7
+ import datetime
8
 
9
  api_key = os.environ.get('FEATHERLESS_API_KEY')
10
  client = OpenAI(
 
50
  model_choices = build_model_choices()
51
 
52
  def initial_model(referer=None):
53
+
54
  if referer == 'http://127.0.0.1:7860/':
55
+ return 'Sao10K/Venomia-1.1-m7'
56
+
57
  if referer and referer.startswith("https://huggingface.co/"):
58
  possible_model = referer[23:]
59
  full_model_list = functools.reduce(lambda x,y: x+y, model_cache.values(), [])
 
61
  if model_is_supported:
62
  return possible_model
63
 
64
+ # let's use a random but different model each day.
65
+ key=os.environ.get('RANDOM_SEED', 'kcOtfNHA+e')
66
+ o = random.Random(f"{key}-{datetime.date.today().strftime('%Y-%m-%d')}")
67
+ return o.choice(model_choices)[1]
68
 
69
  title_text="HuggingFace's missing inference widget"
70
  with gr.Blocks(title_text, css='.logo-mark { fill: #ffe184; }') as demo: