Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| # In[2]: | |
| # In[3]: | |
| # In[4]: | |
| # In[5]: | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| # In[10]: | |
| # In[ ]: | |
| # In[11]: | |
| learn = load_learner ('hemorrhage_model.pkl') | |
| # In[12]: | |
| categories = ('hemorrhage', 'no_hemorrhage') | |
| def classify_image (img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict (zip(categories, map (float, probs))) | |
| # In[17]: | |
| image = gr.Image () | |
| label = gr.Label () | |
| examples = ['test.jpg', 'test1.jpg'] | |
| intf = gr.Interface (fn=classify_image, inputs= image, outputs= label, examples= examples) | |
| intf.launch (inline=False,share=True) | |
| # In[18]: | |
| # get_ipython().system('gradio deploy') | |
| # In[ ]: | |