Spaces:
Runtime error
Runtime error
Commit
•
ebbf054
1
Parent(s):
85faa02
Update app.py
Browse files
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",
|
32 |
['A poem about the beauty of science by Alfred Edgar Brittle\nTitle: The Magic Craft\nIn the old times', 64,
|
33 |
-
"sampling",
|
34 |
-
['استخراج العدد العاملي في لغة بايثون:', 64, "sampling",
|
35 |
-
["Pour déguster un ortolan, il faut tout d'abord", 64, "sampling",
|
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",
|
39 |
[
|
40 |
'Estos ejemplos quitan vocales de las palabras\nEjemplos:\nhola - hl\nmanzana - mnzn\npapas - pps\nalacran - lcrn\npapa -',
|
41 |
-
64, "sampling",
|
42 |
-
["Question: If I put cheese into the fridge, will it melt?\nAnswer:", 64, "sampling",
|
43 |
-
["Math exercise - answers:\n34+10=44\n54+20=", 64, "sampling",
|
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",
|
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",
|
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 |
-
|
|
|
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=
|
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,
|