Allen Park commited on
Commit
0bb5671
·
1 Parent(s): 187d857

fix(add example section and set theme spacing to small)

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -95,6 +95,10 @@ HEADER = """
95
  **Getting Started**: Provide a question and document or context given to your model in addition to the answer given by the model and then click submit. The output panel will indicate whether the reponse is a hallucination (Fail) or if it is faithful to the given document or context (Pass) through the score Pass or Fail and provide reasoning behind the score.
96
  """
97
 
 
 
 
 
98
  UPLOADABLE_FILE_TYPES = [".pdf", ".txt", ".docx", ".doc"]
99
 
100
  css = """
@@ -198,7 +202,7 @@ def select_template(template):
198
  # def download_file():
199
  # return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
200
 
201
- with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Plus Jakarta Sans"), "Arial", "sans-serif"], primary_hue="indigo", secondary_hue="purple")) as demo:
202
  base_url_state = gr.State(update_client_base_url("Patronus Lynx 8B v1.1"))
203
  gr.Markdown(HEADER)
204
  model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B v1.1", "Patronus Lynx 70B"], value="Patronus Lynx 8B v1.1", label="Model", interactive=True)
@@ -222,15 +226,16 @@ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Plus
222
  with gr.Column(scale=1):
223
  reasoning = gr.Textbox(label="Reasoning")
224
  score = gr.Textbox(label="Score (FAIL if Hallucinated, PASS if not)")
225
- with gr.Row():
226
- with gr.Column(spacing="sm"):
227
- for _, example in enumerate(EXAMPLES):
228
- template_btn = gr.Button(f"{example['emoji']} {example['question']}", elem_classes="example-button")
229
- template_btn.click(
230
- fn=select_template,
231
- inputs=[gr.State(example)],
232
- outputs=[question, document, answer]
233
- )
 
234
 
235
  model_dropdown.change(fn=update_client_base_url, inputs=[model_dropdown], outputs=[base_url_state])
236
  u.upload(upload_file, u, [u, file_group, file_name, document])
 
95
  **Getting Started**: Provide a question and document or context given to your model in addition to the answer given by the model and then click submit. The output panel will indicate whether the reponse is a hallucination (Fail) or if it is faithful to the given document or context (Pass) through the score Pass or Fail and provide reasoning behind the score.
96
  """
97
 
98
+ EXAMPLES_HEADER = """
99
+ # Try it Yourself!
100
+ """
101
+
102
  UPLOADABLE_FILE_TYPES = [".pdf", ".txt", ".docx", ".doc"]
103
 
104
  css = """
 
202
  # def download_file():
203
  # return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
204
 
205
+ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Plus Jakarta Sans"), "Arial", "sans-serif"], primary_hue="indigo", secondary_hue="purple"), spacing_size="sm") as demo:
206
  base_url_state = gr.State(update_client_base_url("Patronus Lynx 8B v1.1"))
207
  gr.Markdown(HEADER)
208
  model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B v1.1", "Patronus Lynx 70B"], value="Patronus Lynx 8B v1.1", label="Model", interactive=True)
 
226
  with gr.Column(scale=1):
227
  reasoning = gr.Textbox(label="Reasoning")
228
  score = gr.Textbox(label="Score (FAIL if Hallucinated, PASS if not)")
229
+ gr.Markdown(EXAMPLES_HEADER)
230
+ with gr.Row():
231
+ with gr.Column():
232
+ for _, example in enumerate(EXAMPLES):
233
+ template_btn = gr.Button(f"{example['emoji']} {example['question']}", elem_classes="example-button")
234
+ template_btn.click(
235
+ fn=select_template,
236
+ inputs=[gr.State(example)],
237
+ outputs=[question, document, answer]
238
+ )
239
 
240
  model_dropdown.change(fn=update_client_base_url, inputs=[model_dropdown], outputs=[base_url_state])
241
  u.upload(upload_file, u, [u, file_group, file_name, document])