akhaliq HF staff commited on
Commit
839b81b
·
1 Parent(s): 3ece21c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -8
app.py CHANGED
@@ -7,12 +7,7 @@ import tensorflow_hub as hub
7
  import matplotlib.pyplot as plt
8
  import gradio as gr
9
 
10
- os.environ["TFHUB_DOWNLOAD_PROGRESS"] = "True"
11
-
12
- os.system("wget https://user-images.githubusercontent.com/12981474/40157448-eff91f06-5953-11e8-9a37-f6b5693fa03f.png -O original.png")
13
-
14
  # Declaring Constants
15
- IMAGE_PATH = "original.png"
16
  SAVED_MODEL_PATH = "https://tfhub.dev/captain-pool/esrgan-tf2/1"
17
 
18
  def preprocess_image(image_path):
@@ -46,12 +41,10 @@ def plot_image(image):
46
  model = hub.load(SAVED_MODEL_PATH)
47
  def inference(img):
48
  hr_image = preprocess_image(img)
49
- start = time.time()
50
  fake_image = model(hr_image)
51
  fake_image = tf.squeeze(fake_image)
52
- print("Time Taken: %f" % (time.time() - start))
53
  pil_image = plot_image(tf.squeeze(fake_image))
54
  return pil_image
55
 
56
- gr.Interface(inference,gr.inputs.Image(type="filepath"),"image").launch(enable_queue=True)
57
 
 
7
  import matplotlib.pyplot as plt
8
  import gradio as gr
9
 
 
 
 
 
10
  # Declaring Constants
 
11
  SAVED_MODEL_PATH = "https://tfhub.dev/captain-pool/esrgan-tf2/1"
12
 
13
  def preprocess_image(image_path):
 
41
  model = hub.load(SAVED_MODEL_PATH)
42
  def inference(img):
43
  hr_image = preprocess_image(img)
 
44
  fake_image = model(hr_image)
45
  fake_image = tf.squeeze(fake_image)
 
46
  pil_image = plot_image(tf.squeeze(fake_image))
47
  return pil_image
48
 
49
+ gr.Interface(inference,gr.inputs.Image(type="filepath",shape=(256,256)),"image").launch(enable_queue=True)
50