Spaces:
Runtime error
Runtime error
Commit
·
868dbd1
1
Parent(s):
4943816
Fixes for certain imports
Browse files
app.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
from pathlib import Path
|
|
|
|
|
|
|
| 2 |
from huggingface_hub import from_pretrained_fastai
|
| 3 |
|
| 4 |
|
|
@@ -9,7 +11,7 @@ LABELS = Path('class_names.txt').read_text().splitlines()
|
|
| 9 |
def predict(im):
|
| 10 |
learner = from_pretrained_fastai("rajeshradhakrishnan/ml-news-classify-fastai")
|
| 11 |
|
| 12 |
-
probabilities = learner.predict(
|
| 13 |
|
| 14 |
values, indices = torch.topk(probabilities, 5)
|
| 15 |
|
|
@@ -20,8 +22,8 @@ interface = gr.Interface(
|
|
| 20 |
inputs="newsheadlines",
|
| 21 |
outputs='label',
|
| 22 |
theme="huggingface",
|
| 23 |
-
title="
|
| 24 |
-
description="
|
| 25 |
article = "<p style='text-align: center'>Malayalam News Classifier | Demo Model</p>",
|
| 26 |
live=True)
|
| 27 |
interface.launch(debug=True)
|
|
|
|
| 1 |
from pathlib import Path
|
| 2 |
+
import torch
|
| 3 |
+
import gradio as gr
|
| 4 |
from huggingface_hub import from_pretrained_fastai
|
| 5 |
|
| 6 |
|
|
|
|
| 11 |
def predict(im):
|
| 12 |
learner = from_pretrained_fastai("rajeshradhakrishnan/ml-news-classify-fastai")
|
| 13 |
|
| 14 |
+
probabilities = learner.predict(im)
|
| 15 |
|
| 16 |
values, indices = torch.topk(probabilities, 5)
|
| 17 |
|
|
|
|
| 22 |
inputs="newsheadlines",
|
| 23 |
outputs='label',
|
| 24 |
theme="huggingface",
|
| 25 |
+
title="Malayalam News Classifier",
|
| 26 |
+
description="Try to classify news in മലയാളം? Input a few malayalam news headlines and verify whether the model categorized it apporpirately!",
|
| 27 |
article = "<p style='text-align: center'>Malayalam News Classifier | Demo Model</p>",
|
| 28 |
live=True)
|
| 29 |
interface.launch(debug=True)
|