Spaces:
Runtime error
Runtime error
fixing
Browse files- app.py +3 -1
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 3 |
import torch
|
|
|
|
| 4 |
|
| 5 |
model_name = "dancrvlh/Language"
|
| 6 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
|
@@ -19,7 +20,8 @@ def predict(text):
|
|
| 19 |
inputs = tokenizer(text, return_tensors="pt")
|
| 20 |
outputs = model(**inputs)
|
| 21 |
predictions = outputs.logits
|
| 22 |
-
return mapping[round(predictions.item())]
|
|
|
|
| 23 |
|
| 24 |
iface = gr.Interface(
|
| 25 |
fn=predict,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 3 |
import torch
|
| 4 |
+
import numpy as np
|
| 5 |
|
| 6 |
model_name = "dancrvlh/Language"
|
| 7 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
|
|
|
| 20 |
inputs = tokenizer(text, return_tensors="pt")
|
| 21 |
outputs = model(**inputs)
|
| 22 |
predictions = outputs.logits
|
| 23 |
+
return mapping[round(np.exp(predictions.item()))]
|
| 24 |
+
|
| 25 |
|
| 26 |
iface = gr.Interface(
|
| 27 |
fn=predict,
|
requirements.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
pip
|
| 2 |
gradio
|
| 3 |
transformers
|
| 4 |
-
torch
|
|
|
|
|
|
| 1 |
pip
|
| 2 |
gradio
|
| 3 |
transformers
|
| 4 |
+
torch
|
| 5 |
+
numpy
|