sooooner commited on
Commit
1d2e98e
Β·
1 Parent(s): 66f0272
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +8 -9
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🐒
4
  colorFrom: purple
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 4.42.0
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: purple
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 4.44.0
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -4,14 +4,13 @@ import argparse
4
  import gradio as gr
5
  import spaces
6
 
7
- # from utils import Image2Text
8
 
9
  @spaces.GPU(duration=60)
10
  def predict(input_img):
11
- return {'0': 'hellow', '1': 'world'}
12
- # global image_to_text
13
- # contents = image_to_text.get_text(input_img, num_beams=4)
14
- # return contents
15
 
16
  def get_image_path_list(folder_name):
17
  image_basename_list = os.listdir(folder_name)
@@ -90,11 +89,11 @@ css = """
90
  """
91
 
92
  if __name__ == "__main__":
93
- # repo_id = os.getenv('MODEL_REPO_ID')
94
- # hf_token = os.environ.get("HF_TOKEN")
95
 
96
- # device = "cuda"
97
- # image_to_text = Image2Text(repo_id, hf_token=hf_token, device=device)
98
 
99
  with gr.Blocks(css=css) as demo:
100
  gr.Markdown(title)
 
4
  import gradio as gr
5
  import spaces
6
 
7
+ from utils import Image2Text
8
 
9
  @spaces.GPU(duration=60)
10
  def predict(input_img):
11
+ global image_to_text
12
+ contents = image_to_text.get_text(input_img, num_beams=4)
13
+ return contents
 
14
 
15
  def get_image_path_list(folder_name):
16
  image_basename_list = os.listdir(folder_name)
 
89
  """
90
 
91
  if __name__ == "__main__":
92
+ repo_id = os.getenv('MODEL_REPO_ID')
93
+ hf_token = os.environ.get("HF_TOKEN")
94
 
95
+ device = "cuda"
96
+ image_to_text = Image2Text(repo_id, hf_token=hf_token, device=device)
97
 
98
  with gr.Blocks(css=css) as demo:
99
  gr.Markdown(title)