abidlabs HF staff commited on
Commit
625a980
·
verified ·
1 Parent(s): fe50e4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -40,11 +40,21 @@ gradio-app {
40
  border-color: black !important;
41
  color: white !important;
42
  }
 
43
 
 
 
 
44
 
45
-
 
 
 
 
46
  """
47
 
 
 
48
  system_prompt = """
49
  You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
50
  """
@@ -86,7 +96,7 @@ def random_prompt():
86
  "Write a couplet about Python"
87
  ])
88
 
89
- with gr.Blocks(css=css, theme="NoCrypt/miku") as demo:
90
  gr.Markdown("<center><h1>🔮 Open LLM Explorer</h1></center>")
91
  gr.Markdown("Type your prompt below and compare results from the 3 leading open models from the [Open LLM Leaderboard](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) that are on the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/en/index).")
92
  prompt = gr.Textbox(random_prompt, lines=2, show_label=False, info="Type your prompt here.")
 
40
  border-color: black !important;
41
  color: white !important;
42
  }
43
+ """
44
 
45
+ js = """
46
+ function refresh() {
47
+ const url = new URL(window.location);
48
 
49
+ if (url.searchParams.get('__theme') === 'dark') {
50
+ url.searchParams.set('__theme', 'light');
51
+ window.location.href = url.href;
52
+ }
53
+ }
54
  """
55
 
56
+
57
+
58
  system_prompt = """
59
  You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
60
  """
 
96
  "Write a couplet about Python"
97
  ])
98
 
99
+ with gr.Blocks(css=css, theme="NoCrypt/miku", js=js) as demo:
100
  gr.Markdown("<center><h1>🔮 Open LLM Explorer</h1></center>")
101
  gr.Markdown("Type your prompt below and compare results from the 3 leading open models from the [Open LLM Leaderboard](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) that are on the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/en/index).")
102
  prompt = gr.Textbox(random_prompt, lines=2, show_label=False, info="Type your prompt here.")