Tech-Meld commited on
Commit
37cfd4a
·
verified ·
1 Parent(s): 4cf5f47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,7 +4,7 @@ import time
4
  import random
5
 
6
  # Load the model and tokenizer
7
- model_id = "microsoft/phi-2"
8
  tokenizer = AutoTokenizer.from_pretrained(model_id)
9
  model = AutoModelForCausalLM.from_pretrained(model_id)
10
 
@@ -68,10 +68,11 @@ with gr.Blocks() as iface:
68
  r = random.randint(0, 255)
69
  g = 255 # Keep the green component constant
70
  b = random.randint(0, 255)
71
- iface.root.style.background_color = f"rgb({r}, {g}, {b})"
 
72
  time.sleep(1)
73
 
74
  # Start a separate thread to update the background color
75
- gr.Interface.update(update_background, inputs=[], outputs=[], live=True)
76
 
77
  iface.launch(debug=True)
 
4
  import random
5
 
6
  # Load the model and tokenizer
7
+ model_id = "microsoft/phi-2" # Change to your desired model
8
  tokenizer = AutoTokenizer.from_pretrained(model_id)
9
  model = AutoModelForCausalLM.from_pretrained(model_id)
10
 
 
68
  r = random.randint(0, 255)
69
  g = 255 # Keep the green component constant
70
  b = random.randint(0, 255)
71
+ gr.update(iface.root, value=f"rgb({r}, {g}, {b})",
72
+ _js="style.background_color")
73
  time.sleep(1)
74
 
75
  # Start a separate thread to update the background color
76
+ gr.update(update_background, inputs=[], outputs=[], live=True)
77
 
78
  iface.launch(debug=True)