antonbol commited on
Commit
4bf0388
1 Parent(s): c22ad31

return number instea dof img

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -15,7 +15,7 @@ mr = project.get_model_registry()
15
  model = mr.get_model("titanic_modal_simple_classifier", version=1)
16
  model_dir = model.download()
17
  model = joblib.load(model_dir + "/titanic_model.pkl")
18
- leo_url = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxAQDw8PEA4NDw0PDw0PDQ8NDw8NDQ0NFREWFhURFRUYHSggGBolGxUVITEhJSkrLi4uFx8zOD8tNygtLisBCgoKDg0OFxAQFy0dHR8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tOC4tLS0tLSstLS0tKy0rLSstLS0rLSstNy0tK//AABEIAMgA/AMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAAAwQBAgUGB//EAC4QAAICAQIFBAICAQUBAAAAAAABAgMRBCESMUFTkgUUUWEicRORgQYyUnLRFf/EABkBAQADAQEAAAAAAAAAAAAAAAABAwQCBf/EACIRAQEAAwACAgIDAQAAAAAAAAABAgMREiEEMSIyE0FRQv/aAAwDAQACEQMRAD8A+J+6s7lnnIe6s7lnnIhBIm91Z3LPOQ91Z3LPOREBwS+6s7lnnIz7mzuWeciAySJvc2dyzzkY91Z3LPOREYIE/ubO5Z5yMe6s7lnnIhBAm91Z3LPOQ91Z3LPORCAJvdWdyzzkPdWdyzzkQgnom91Z3LPOX/pn3Vncs85EAIE/ubO5Z5yMe6s7lnnIiAEvurO5Z5yHubO5Z5yIgBL7mzuWech7mzuWeciIAS+5s7lnnIe5s7lnnIiAEvurO5Z5yHurO5Z5yIgBL7qzuWech7qzuWeciIwBN7qzuWech7qzuWeciIICX3Vncs85D3Vncs85EZqAAAAAE9AADoAAgAAAAAGRg2hHcuxo2O8cOuMs5ioYMFyNO+CLUU8LwRcbCZyoQ0ZSDZy6YAASAAAAYAyDBkAYAAyDAAyYAAAAAAAAAAAAAAA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e3NBNPpQ&usqp=CAU"
20
  # leo_url = "https://media.tenor.com/FghTtX3ZgbAAAAAC/drowning-leo.gif"
21
  # rose_url = "https://media4.giphy.com/media/6A5zBPtbknIGY/giphy.gif?cid=ecf05e477syp5zeoheii45de76uicvgu0nuegojslz3zgodt&rid=giphy.gif&ct=g"
@@ -29,7 +29,7 @@ def titanic(pclass, name, sex, age, sibsp, parch, ticket, fare, cabin, embarked)
29
  # the first element.
30
 
31
  img = Image.open(leo_url) if res == 0 else Image.open(rose_url)
32
- return img
33
 
34
  demo = gr.Interface(
35
  fn=titanic,
@@ -48,6 +48,6 @@ demo = gr.Interface(
48
  gr.inputs.Textbox(default="A123", label="Cabin"),
49
  gr.inputs.Textbox(default="S", label="Embarked: [S, C, Q]")
50
  ],
51
- outputs=gr.Image(type="pil"))
52
 
53
  demo.launch()
 
15
  model = mr.get_model("titanic_modal_simple_classifier", version=1)
16
  model_dir = model.download()
17
  model = joblib.load(model_dir + "/titanic_model.pkl")
18
+ leo_url = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxAREA8QDxAQEA8PDw0PDw8NDQ8PDw0PFREWFhURExUYHSggGBolGxUVITEhJSkrLi4uFx8zODM4NygtOisBCgoKDg0OGhAQFy0fHR0tKy0rLSstLS0tLS0tLS0tLS0tLS0tKystLS0tLS0tLSstLTctLS0tLTctKy0rKysrK//AABEIAJQBVQMBIgACEQEDEQH/xAAbAAEAAwEBAQEAAAAAAAAAAAAAAQMEAgUGB//EAC8QAQABAwMDAgUDBAMAAAAAAAABAgMRBCExEkFRBWEicYGRoTJSsRMUQvAVYvH/xAAYAQEAAwEAAAAAAAAAAAAAAAAAAQIDBP/EACERAQEAAgICAgMBAAAAAAAAAAABAhEDIRIxMkETQlEE/9oADAMBAAIRAxEAPwD8PwYSJEYMJARgwlKUbc4MOg0bc4MOg0bc4MOg0bc4MOg0bc4T0pE6NucHSkyjoRgwJVEYMABgwECTBhKUjnBh0gEYMJQhAA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AAAAAbfTbcTMzPbhA04vkpyfGvV0dMTEz3dXIB1uP7LTZRACuTi7LwfU7k9eM7YjbsCnJ8W3B8m30u7OMKvU6t5+gI/VM+bJY5X3eAVnpe+1dE7OqgSIV0gipX2N+WXVc47Arn6Tj7KOIW0AmIyaKFtqqcg1jGtmXUAspU9JhIIczDJqKI3hAX0me3iVIBwX271+jtRVXTTPEzEThVdpxVVHiZj7SkT9H24AVAAH/2Q=="
19
  rose_url = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSGoi8okN1Fw6tYE7k-0H-wnMabl1e3NBNPpQ&usqp=CAU"
20
  # leo_url = "https://media.tenor.com/FghTtX3ZgbAAAAAC/drowning-leo.gif"
21
  # rose_url = "https://media4.giphy.com/media/6A5zBPtbknIGY/giphy.gif?cid=ecf05e477syp5zeoheii45de76uicvgu0nuegojslz3zgodt&rid=giphy.gif&ct=g"
 
29
  # the first element.
30
 
31
  img = Image.open(leo_url) if res == 0 else Image.open(rose_url)
32
+ return res
33
 
34
  demo = gr.Interface(
35
  fn=titanic,
 
48
  gr.inputs.Textbox(default="A123", label="Cabin"),
49
  gr.inputs.Textbox(default="S", label="Embarked: [S, C, Q]")
50
  ],
51
+ outputs=gr.Number())
52
 
53
  demo.launch()