Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import warnings
|
2 |
import gradio as gr
|
3 |
-
from transformers
|
|
|
|
|
|
|
4 |
import torch
|
5 |
from custom_model import CustomModel
|
6 |
|
@@ -21,7 +24,8 @@ print(f"Loading model from {model_name}...")
|
|
21 |
model = CustomModel.from_pretrained(model_name, config=config, revision=revision, trust_remote_code=True)
|
22 |
|
23 |
if model is None:
|
24 |
-
print("Failed to load model.")
|
|
|
25 |
else:
|
26 |
print("Model loaded successfully.")
|
27 |
|
@@ -40,10 +44,10 @@ def classify_text(text):
|
|
40 |
try:
|
41 |
iface = gr.Interface(
|
42 |
fn=classify_text,
|
43 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
44 |
outputs=[
|
45 |
-
gr.Label(label="Predicted Class"),
|
46 |
-
gr.Label(label="Probabilities")
|
47 |
],
|
48 |
title="DeepSeek-V3 Text Classification",
|
49 |
description="Classify text using the DeepSeek-V3 model."
|
|
|
1 |
import warnings
|
2 |
import gradio as gr
|
3 |
+
from transformers ```python
|
4 |
+
import warnings
|
5 |
+
import gradio as gr
|
6 |
+
from transformers import AutoTokenizer, AutoConfig
|
7 |
import torch
|
8 |
from custom_model import CustomModel
|
9 |
|
|
|
24 |
model = CustomModel.from_pretrained(model_name, config=config, revision=revision, trust_remote_code=True)
|
25 |
|
26 |
if model is None:
|
27 |
+
print("Failed to load model. Exiting...")
|
28 |
+
exit(1)
|
29 |
else:
|
30 |
print("Model loaded successfully.")
|
31 |
|
|
|
44 |
try:
|
45 |
iface = gr.Interface(
|
46 |
fn=classify_text,
|
47 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
48 |
outputs=[
|
49 |
+
gr.Label(label="Predicted Class"),
|
50 |
+
gr.Label(label="Probabilities")
|
51 |
],
|
52 |
title="DeepSeek-V3 Text Classification",
|
53 |
description="Classify text using the DeepSeek-V3 model."
|