Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
3 |
-
import torch
|
4 |
-
from transformers import AutoModelForSequenceClassification
|
5 |
-
import os
|
6 |
-
from huggingface_hub import login
|
7 |
-
|
8 |
-
token = os.getenv("HF_TOKEN") # HF_TOKEN should be set in your environment
|
9 |
-
login(token=token)
|
10 |
-
|
11 |
-
model_path = "SivaMallikarjun/multi-lang-rl-model"
|
12 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
13 |
-
model_path = "SivaMallikarjun/multi-lang-rl-model"
|
14 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
15 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
16 |
-
|
17 |
-
def classify_text(text):
|
18 |
-
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
|
19 |
-
outputs = model(**inputs)
|
20 |
-
prediction = torch.argmax(outputs.logits, dim=1).item()
|
21 |
-
label = "Correct" if prediction == 1 else "Incorrect"
|
22 |
-
return label
|
23 |
-
|
24 |
-
iface = gr.Interface(fn=classify_text,
|
25 |
-
inputs="text",
|
26 |
-
outputs="text",
|
27 |
-
title="Multi-Language RL Text Classifier")
|
28 |
-
|
29 |
-
if __name__ == "__main__":
|
30 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|