liamcripwell commited on
Commit
7d46eac
1 Parent(s): 07601de

flag example runs

Browse files
Files changed (2) hide show
  1. app.py +5 -2
  2. examples.py +11 -10
app.py CHANGED
@@ -118,7 +118,7 @@ model = AutoModelForCausalLM.from_pretrained(model_name,
118
  tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=auth_token)
119
  model.eval()
120
 
121
- def gradio_interface_function(template, text):
122
  # reject invalid JSON
123
  try:
124
  template_json = json.loads(template)
@@ -138,7 +138,9 @@ def gradio_interface_function(template, text):
138
  # yield gr.update(value=chunk_info), gr.update(value=progress), gr.update(value=full_pred), gr.update(value=html_content)
139
  yield progress, full_pred, html_content
140
 
141
- log_event(text, template, full_pred)
 
 
142
 
143
  # Set up the Gradio interface
144
  iface = gr.Interface(
@@ -147,6 +149,7 @@ iface = gr.Interface(
147
  inputs=[
148
  gr.Textbox(lines=2, placeholder="Enter Template here...", label="Template"),
149
  gr.Textbox(lines=2, placeholder="Enter input Text here...", label="Input Text"),
 
150
  ],
151
  outputs=[
152
  gr.Textbox(label="Progress"),
 
118
  tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=auth_token)
119
  model.eval()
120
 
121
+ def gradio_interface_function(template, text, is_example):
122
  # reject invalid JSON
123
  try:
124
  template_json = json.loads(template)
 
138
  # yield gr.update(value=chunk_info), gr.update(value=progress), gr.update(value=full_pred), gr.update(value=html_content)
139
  yield progress, full_pred, html_content
140
 
141
+ if not is_example:
142
+ log_event(text, template, full_pred)
143
+
144
 
145
  # Set up the Gradio interface
146
  iface = gr.Interface(
 
149
  inputs=[
150
  gr.Textbox(lines=2, placeholder="Enter Template here...", label="Template"),
151
  gr.Textbox(lines=2, placeholder="Enter input Text here...", label="Input Text"),
152
+ gr.Checkbox(label="Is Example?", visible=False),
153
  ],
154
  outputs=[
155
  gr.Textbox(label="Progress"),
examples.py CHANGED
@@ -1,6 +1,6 @@
1
  # Example inputs for the user to choose from
2
  examples = [
3
- ["""{
4
  "Model": {
5
  "Name": "",
6
  "Number of parameters": "",
@@ -21,8 +21,8 @@ reduced inference cost. We also provide a model fine-tuned to follow instruction
21
  Mistral 7B – Instruct, that surpasses Llama 2 13B – chat model both on human and
22
  automated benchmarks. Our models are released under the Apache 2.0 license.
23
  Code: https://github.com/mistralai/mistral-src
24
- Webpage: https://mistral.ai/news/announcing-mistral-7b/"""],
25
- ["""{
26
  "Doctor_Patient_Discussion": {
27
  "Initial_Observation": {
28
  "Symptoms": [],
@@ -64,8 +64,8 @@ Doctor: OK. You’ve few symptoms of malaria. I would suggest you undergo blood
64
  Doctor: I’m prescribing three medicines and a syrup. The number of dots in front of each tells you how many times in the day you’ve to take them. For example, the two dots here mean you’ve to take the medicine twice in the day, once in the morning and once after dinner.
65
  Doctor: Do you’ve any other questions?
66
  Patient: No, doctor. Thank you.
67
- """],
68
- ["""{
69
  "Name": "",
70
  "Age": "",
71
  "Educations": [
@@ -121,8 +121,8 @@ Technical Expertise
121
  MS Excel, PowerPoint, Relational Databases, Project Management, Quantitative Analysis, SQL, Java
122
  Additional
123
  Organized computer and English literacy workshops for underprivileged children in South Asia, 2013
124
- Student Scholarship Recipient, National Conference on Race and Ethnicity, 2007-2008"""],
125
- ["""{
126
  "Name_act": "",
127
  "Director": "",
128
  "Location": [
@@ -138,8 +138,9 @@ Student Scholarship Recipient, National Conference on Race and Ethnicity, 2007-2
138
  ]
139
  }
140
  ]
141
- }""",""""Libretto by Marius Petipa, based on the 1822 novella ``Trilby, ou Le Lutin d'Argail`` by Charles Nodier, first presented by the Ballet of the Moscow Imperial Bolshoi Theatre on January 25/February 6 (Julian/Gregorian calendar dates), 1870, in Moscow with Polina Karpakova as Trilby and Ludiia Geiten as Miranda and restaged by Petipa for the Imperial Ballet at the Imperial Bolshoi Kamenny Theatre on January 17–29, 1871 in St. Petersburg with Adèle Grantzow as Trilby and Lev Ivanov as Count Leopold."""],
142
- ["""{
 
143
  "birth_date": "",
144
  "current_team": "",
145
  "past_f1_teams": [],
@@ -326,6 +327,6 @@ Longest time between first and last points finishes 7,812 days 2024 Canadian Gra
326
  Longest time between first and last podium finishes 7,532 days 2023 Dutch Grand Prix
327
  Most races between successive podium finishes 105 2021 Qatar Grand Prix
328
  Furthest distance driven in F1 106,477 km 2022 British Grand Prix
329
- Most laps driven in F1 21,287 laps 2023 Italian Grand Prix """],
330
 
331
  ]
 
1
  # Example inputs for the user to choose from
2
  examples = [
3
+ ("""{
4
  "Model": {
5
  "Name": "",
6
  "Number of parameters": "",
 
21
  Mistral 7B – Instruct, that surpasses Llama 2 13B – chat model both on human and
22
  automated benchmarks. Our models are released under the Apache 2.0 license.
23
  Code: https://github.com/mistralai/mistral-src
24
+ Webpage: https://mistral.ai/news/announcing-mistral-7b/""", True),
25
+ ("""{
26
  "Doctor_Patient_Discussion": {
27
  "Initial_Observation": {
28
  "Symptoms": [],
 
64
  Doctor: I’m prescribing three medicines and a syrup. The number of dots in front of each tells you how many times in the day you’ve to take them. For example, the two dots here mean you’ve to take the medicine twice in the day, once in the morning and once after dinner.
65
  Doctor: Do you’ve any other questions?
66
  Patient: No, doctor. Thank you.
67
+ """, True),
68
+ ("""{
69
  "Name": "",
70
  "Age": "",
71
  "Educations": [
 
121
  MS Excel, PowerPoint, Relational Databases, Project Management, Quantitative Analysis, SQL, Java
122
  Additional
123
  Organized computer and English literacy workshops for underprivileged children in South Asia, 2013
124
+ Student Scholarship Recipient, National Conference on Race and Ethnicity, 2007-2008""", True),
125
+ ("""{
126
  "Name_act": "",
127
  "Director": "",
128
  "Location": [
 
138
  ]
139
  }
140
  ]
141
+ }""",""""Libretto by Marius Petipa, based on the 1822 novella ``Trilby, ou Le Lutin d'Argail`` by Charles Nodier, first presented by the Ballet of the Moscow Imperial Bolshoi Theatre on January 25/February 6 (Julian/Gregorian calendar dates), 1870, in Moscow with Polina Karpakova as Trilby and Ludiia Geiten as Miranda and restaged by Petipa for the Imperial Ballet at the Imperial Bolshoi Kamenny Theatre on January 17–29, 1871 in St. Petersburg with Adèle Grantzow as Trilby and Lev Ivanov as Count Leopold."""
142
+ , True),
143
+ ("""{
144
  "birth_date": "",
145
  "current_team": "",
146
  "past_f1_teams": [],
 
327
  Longest time between first and last podium finishes 7,532 days 2023 Dutch Grand Prix
328
  Most races between successive podium finishes 105 2021 Qatar Grand Prix
329
  Furthest distance driven in F1 106,477 km 2022 British Grand Prix
330
+ Most laps driven in F1 21,287 laps 2023 Italian Grand Prix """, True),
331
 
332
  ]