sohojoe commited on
Commit
91e4bde
1 Parent(s): b255c4c

use a better sample image

Browse files
Files changed (1) hide show
  1. api_test.py +3 -3
api_test.py CHANGED
@@ -7,6 +7,8 @@ import torch
7
  from api_helper import preprocess_image, encode_numpy_array
8
  clip_image_size = 224
9
  num_steps = 1000
 
 
10
 
11
  client = Client("http://127.0.0.1:7860/")
12
 
@@ -21,7 +23,7 @@ def test_text():
21
 
22
  def test_image():
23
  result = client.predict(
24
- "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str representing filepath or URL to image in 'Image Prompt' Image component
25
  api_name="/image_to_embeddings"
26
  )
27
  return(result)
@@ -55,7 +57,6 @@ print("Number of predictions per second for image: ", 1 / average_time_seconds)
55
 
56
 
57
 
58
- test_image_url = "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png"
59
  # download image from url
60
  import requests
61
  from PIL import Image
@@ -66,7 +67,6 @@ input_image = input_image.convert('RGB')
66
  # convert image to numpy array
67
  input_image = np.array(input_image)
68
 
69
-
70
  if input_image.shape[0] > clip_image_size or input_image.shape[1] > clip_image_size:
71
  input_image = preprocess_image(input_image, clip_image_size)
72
  payload = encode_numpy_array(input_image)
 
7
  from api_helper import preprocess_image, encode_numpy_array
8
  clip_image_size = 224
9
  num_steps = 1000
10
+ test_image_url = "https://static.wixstatic.com/media/4d6b49_42b9435ce1104008b1b5f7a3c9bfcd69~mv2.jpg/v1/fill/w_454,h_333,fp_0.50_0.50,q_90/4d6b49_42b9435ce1104008b1b5f7a3c9bfcd69~mv2.jpg"
11
+
12
 
13
  client = Client("http://127.0.0.1:7860/")
14
 
 
23
 
24
  def test_image():
25
  result = client.predict(
26
+ test_image_url, # str representing filepath or URL to image in 'Image Prompt' Image component
27
  api_name="/image_to_embeddings"
28
  )
29
  return(result)
 
57
 
58
 
59
 
 
60
  # download image from url
61
  import requests
62
  from PIL import Image
 
67
  # convert image to numpy array
68
  input_image = np.array(input_image)
69
 
 
70
  if input_image.shape[0] > clip_image_size or input_image.shape[1] > clip_image_size:
71
  input_image = preprocess_image(input_image, clip_image_size)
72
  payload = encode_numpy_array(input_image)