sanchit-gandhi HF staff commited on
Commit
ebbf054
1 Parent(s): 85faa02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -28,25 +28,25 @@ API_URL = os.getenv("API_URL")
28
  examples = [
29
  [
30
  'A "whatpu" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is: We were traveling in Africa and we saw these very cute whatpus. To do a "farduddle" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:',
31
- 64, "sampling", False],
32
  ['A poem about the beauty of science by Alfred Edgar Brittle\nTitle: The Magic Craft\nIn the old times', 64,
33
- "sampling", False],
34
- ['استخراج العدد العاملي في لغة بايثون:', 64, "sampling", False],
35
- ["Pour déguster un ortolan, il faut tout d'abord", 64, "sampling", False],
36
  [
37
  'Traduce español de España a español de Argentina\nEl coche es rojo - el auto es rojo\nEl ordenador es nuevo - la computadora es nueva\nel boligrafo es negro -',
38
- 64, "sampling", False],
39
  [
40
  'Estos ejemplos quitan vocales de las palabras\nEjemplos:\nhola - hl\nmanzana - mnzn\npapas - pps\nalacran - lcrn\npapa -',
41
- 64, "sampling", False],
42
- ["Question: If I put cheese into the fridge, will it melt?\nAnswer:", 64, "sampling", False],
43
- ["Math exercise - answers:\n34+10=44\n54+20=", 64, "sampling", False],
44
  [
45
  "Question: Where does the Greek Goddess Persephone spend half of the year when she is not with her mother?\nAnswer:",
46
- 64, "sampling", False],
47
  [
48
  "spelling test answers.\nWhat are the letters in « language »?\nAnswer: l-a-n-g-u-a-g-e\nWhat are the letters in « Romanian »?\nAnswer:",
49
- 64, "sampling", False]
50
  ]
51
 
52
 
@@ -87,7 +87,8 @@ def inference(input_sentence, max_length, sample_or_greedy, raw_text=True):
87
  BOX_COMP: "#120F25",
88
  }
89
 
90
- new_string = data[0]['generated_text'].split(input_sentence, 1)[1]
 
91
 
92
  _, img = main(
93
  input_sentence,
@@ -111,7 +112,7 @@ gr.Interface(
111
  gr.inputs.Textbox(label="Input"),
112
  gr.inputs.Radio([64], default=64, label="Tokens to generate"),
113
  gr.inputs.Radio(["sampling"], label="Sample or greedy", default="sampling"),
114
- gr.Checkbox(label="Just output raw text", value=False),
115
  ],
116
  ["image", "text"],
117
  examples=examples,
 
28
  examples = [
29
  [
30
  'A "whatpu" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is: We were traveling in Africa and we saw these very cute whatpus. To do a "farduddle" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:',
31
+ 64, "sampling", True],
32
  ['A poem about the beauty of science by Alfred Edgar Brittle\nTitle: The Magic Craft\nIn the old times', 64,
33
+ "sampling", True],
34
+ ['استخراج العدد العاملي في لغة بايثون:', 64, "sampling", True],
35
+ ["Pour déguster un ortolan, il faut tout d'abord", 64, "sampling", True],
36
  [
37
  'Traduce español de España a español de Argentina\nEl coche es rojo - el auto es rojo\nEl ordenador es nuevo - la computadora es nueva\nel boligrafo es negro -',
38
+ 64, "sampling", True],
39
  [
40
  'Estos ejemplos quitan vocales de las palabras\nEjemplos:\nhola - hl\nmanzana - mnzn\npapas - pps\nalacran - lcrn\npapa -',
41
+ 64, "sampling", True],
42
+ ["Question: If I put cheese into the fridge, will it melt?\nAnswer:", 64, "sampling", True],
43
+ ["Math exercise - answers:\n34+10=44\n54+20=", 64, "sampling", True],
44
  [
45
  "Question: Where does the Greek Goddess Persephone spend half of the year when she is not with her mother?\nAnswer:",
46
+ 64, "sampling", True],
47
  [
48
  "spelling test answers.\nWhat are the letters in « language »?\nAnswer: l-a-n-g-u-a-g-e\nWhat are the letters in « Romanian »?\nAnswer:",
49
+ 64, "sampling", True]
50
  ]
51
 
52
 
 
87
  BOX_COMP: "#120F25",
88
  }
89
 
90
+ # TODO: fix screenshot
91
+ new_string = data[0]['generated_text'][0].split(input_sentence, 1)[1]
92
 
93
  _, img = main(
94
  input_sentence,
 
112
  gr.inputs.Textbox(label="Input"),
113
  gr.inputs.Radio([64], default=64, label="Tokens to generate"),
114
  gr.inputs.Radio(["sampling"], label="Sample or greedy", default="sampling"),
115
+ gr.Checkbox(label="Just output raw text", value=True),
116
  ],
117
  ["image", "text"],
118
  examples=examples,