OFA-Sys/OFA-Image_Caption

#1
by Bunpheng - opened
Files changed (3) hide show
  1. README.md +1 -0
  2. app.py +2 -2
  3. fairseq/fairseq/data/indexed_dataset.py +2 -2
README.md CHANGED
@@ -21,5 +21,6 @@ gradio
21
  `app_file`: _string_
22
  app.py
23
 
 
24
  `pinned`: _boolean_
25
  false
21
  `app_file`: _string_
22
  app.py
23
 
24
+
25
  `pinned`: _boolean_
26
  false
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import os
2
 
3
  os.system('cd fairseq;'
4
- 'pip install ./; cd ..')
5
  os.system('ls -l')
6
 
7
  import torch
@@ -120,4 +120,4 @@ examples = [['beatles.jpeg'], ['aurora.jpeg'], ['good_luck.png'], ['pokemons.jpg
120
  io = gr.Interface(fn=image_caption, inputs=gr.inputs.Image(type='pil'), outputs=gr.outputs.Textbox(label="Caption"),
121
  title=title, description=description, article=article, examples=examples,
122
  allow_flagging=False, allow_screenshot=False)
123
- io.launch()
1
  import os
2
 
3
  os.system('cd fairseq;'
4
+ 'pip install --use-feature=in-tree-build ./; cd ..')
5
  os.system('ls -l')
6
 
7
  import torch
120
  io = gr.Interface(fn=image_caption, inputs=gr.inputs.Image(type='pil'), outputs=gr.outputs.Textbox(label="Caption"),
121
  title=title, description=description, article=article, examples=examples,
122
  allow_flagging=False, allow_screenshot=False)
123
+ io.launch(cache_examples=True)
fairseq/fairseq/data/indexed_dataset.py CHANGED
@@ -118,7 +118,7 @@ _code_to_dtype = {
118
  3: np.int16,
119
  4: np.int32,
120
  5: np.int64,
121
- 6: np.float64,
122
  7: np.double,
123
  8: np.uint16,
124
  9: np.uint32,
@@ -325,7 +325,7 @@ class IndexedDatasetBuilder:
325
  np.int16: 2,
326
  np.int32: 4,
327
  np.int64: 8,
328
- np.float64: 4,
329
  np.double: 8,
330
  }
331
 
118
  3: np.int16,
119
  4: np.int32,
120
  5: np.int64,
121
+ 6: np.float,
122
  7: np.double,
123
  8: np.uint16,
124
  9: np.uint32,
325
  np.int16: 2,
326
  np.int32: 4,
327
  np.int64: 8,
328
+ np.float: 4,
329
  np.double: 8,
330
  }
331