Spaces:
Runtime error
Runtime error
Shanaman987
commited on
Commit
•
1d7f96c
1
Parent(s):
0c84e4b
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,14 @@
|
|
1 |
-
import
|
2 |
-
from transformers import AutoTokenizer, ai4bharat/indic-KeyboardInterrupt
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
-
|
|
|
7 |
|
8 |
-
#
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
-
# Build the Gradio interface
|
15 |
-
interface = gr.Interface(fn=generate_text, inputs="text", outputs="text", title="Malayalam Text Generator")
|
16 |
-
interface.launch()
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
|
2 |
|
3 |
+
# Correctly load the tokenizer and model
|
4 |
+
model_name = "ai4bharat/indic-bert"
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
6 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
7 |
|
8 |
+
# Example usage
|
9 |
+
input_text = "This is a sample sentence for classification."
|
10 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
11 |
+
outputs = model(**inputs)
|
12 |
+
|
13 |
+
print(outputs)
|
14 |
|
|
|
|
|
|