jdmartinev commited on
Commit
82e1e14
·
1 Parent(s): deb9bc7
Files changed (2) hide show
  1. app.py +5 -25
  2. building.jpg +0 -0
app.py CHANGED
@@ -1,24 +1,4 @@
1
  import gradio as gr
2
-
3
-
4
- import numpy as np
5
- import gradio as gr
6
-
7
- def sepia(input_img):
8
- sepia_filter = np.array([
9
- [0.393, 0.769, 0.189],
10
- [0.349, 0.686, 0.168],
11
- [0.272, 0.534, 0.131]
12
- ])
13
- sepia_img = input_img.dot(sepia_filter.T)
14
- sepia_img /= sepia_img.max()
15
- return sepia_img
16
-
17
- demo = gr.Interface(sepia, gr.Image(shape=(200, 200)), "image")
18
- demo.launch()
19
-
20
-
21
- """
22
  from fastai.learner import load_learner
23
  from fastai.vision.core import PILImage
24
  from huggingface_hub import hf_hub_download
@@ -31,9 +11,9 @@ def classify_image(image):
31
  pred_class, pred_idx, outputs = learn.predict(img)
32
  return f"Predicted class: {pred_class}"
33
 
34
- interface = gr.Interface(fn=classify_image,
35
- inputs=gr.inputs.Image(type="file", label="Upload an Image"),
36
- outputs="text")
37
 
38
- interface.launch()
39
- """
 
 
 
 
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from fastai.learner import load_learner
3
  from fastai.vision.core import PILImage
4
  from huggingface_hub import hf_hub_download
 
11
  pred_class, pred_idx, outputs = learn.predict(img)
12
  return f"Predicted class: {pred_class}"
13
 
 
 
 
14
 
15
+ demo = gr.Interface(sepia, gr.Image(shape=(200, 200)), "text")
16
+ demo.launch()
17
+
18
+
19
+
building.jpg ADDED