PlengRKO commited on
Commit
cce4c65
·
verified ·
1 Parent(s): 4dfaf45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -4
app.py CHANGED
@@ -11,13 +11,10 @@ from matplotlib import font_manager
11
  import textwrap
12
  import os
13
  import tempfile
14
- import pandas as pd
15
  from huggingface_hub import hf_hub_download
16
 
17
  model_weight = hf_hub_download(repo_id="BAAI/bge-visualized", filename="Visualized_m3.pth")
18
 
19
- data = pd.read_csv("image_url.csv")
20
-
21
  # Load Thai font
22
  thai_font = font_manager.FontProperties(fname='./Sarabun-Regular.ttf')
23
 
@@ -42,7 +39,7 @@ def visualize_results(results):
42
 
43
  for i, res in enumerate(results):
44
  try:
45
- image_url = data.iloc[int(res.payload["index"])]['image_url']
46
  img = Image.open(image_url) if os.path.exists(image_url) else Image.open(BytesIO(requests.get(image_url).content))
47
  name = res.payload['name']
48
  if len(name) > 30:
 
11
  import textwrap
12
  import os
13
  import tempfile
 
14
  from huggingface_hub import hf_hub_download
15
 
16
  model_weight = hf_hub_download(repo_id="BAAI/bge-visualized", filename="Visualized_m3.pth")
17
 
 
 
18
  # Load Thai font
19
  thai_font = font_manager.FontProperties(fname='./Sarabun-Regular.ttf')
20
 
 
39
 
40
  for i, res in enumerate(results):
41
  try:
42
+ image_url = res.payload['image_url']
43
  img = Image.open(image_url) if os.path.exists(image_url) else Image.open(BytesIO(requests.get(image_url).content))
44
  name = res.payload['name']
45
  if len(name) > 30: