ayaderaghul commited on
Commit
e606b53
1 Parent(s): 7f4f297

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -43
app.py DELETED
@@ -1,43 +0,0 @@
1
- import gradio as gr
2
- import keras
3
- from keras.models import load_model
4
- # from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization
5
- from tensorflow_addons.layers import InstanceNormalization
6
- import matplotlib.pyplot as plt
7
- import numpy as np
8
-
9
- cust = {'InstanceNormalization': InstanceNormalization}
10
- model=load_model('g_model_AtoB_002160.h5',cust)
11
- # model=load_model('g_model_AtoB_000540.h5',cust)
12
-
13
- path = [['ex1.jpg'], ['ex2.jpg'], ['ex3.jpg'],['ex4.jpg'],['ex5.jpg']]
14
-
15
- def show_preds_image(image_path):
16
- A = plt.imread(image_path)
17
- # A = (A - 127.5) / 127.5
18
- A = np.expand_dims(A,axis=0)
19
- B = model.predict(A)
20
- B = np.squeeze(B,axis=0)
21
- B = (B + 1) / 2.0
22
- return B
23
-
24
- inputs_image = [
25
- gr.components.Image(shape=(256,256),type="filepath", label="Input Image"),
26
- ]
27
- outputs_image = [
28
- gr.components.Image(shape=(256,256),type="numpy", label="Output Image").style(width=256, height=256),
29
- ]
30
- interface_image = gr.Interface(
31
- fn=show_preds_image,
32
- inputs=inputs_image,
33
- outputs=outputs_image,
34
- title="photo2monet",
35
- examples=path,
36
- cache_examples=False,
37
- )
38
-
39
- gr.TabbedInterface(
40
- [interface_image],
41
- tab_names=['Image inference']
42
- ).queue().launch()
43
-