Spaces:
Build error
Build error
Phuc Nguyen
commited on
Commit
·
692c4cf
1
Parent(s):
9426e82
edit predict func
Browse files- app.py +3 -1
- requirements.txt +4 -2
app.py
CHANGED
|
@@ -10,7 +10,9 @@ classifier = pipeline(
|
|
| 10 |
|
| 11 |
############### Tạo giao diện ###############
|
| 12 |
def predict(text):
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
|
| 15 |
demo = gr.Interface(
|
| 16 |
fn=predict,
|
|
|
|
| 10 |
|
| 11 |
############### Tạo giao diện ###############
|
| 12 |
def predict(text):
|
| 13 |
+
predictions = classifier(text)[0]
|
| 14 |
+
result = {pred['label']: pred['score'] for pred in predictions}
|
| 15 |
+
return result
|
| 16 |
|
| 17 |
demo = gr.Interface(
|
| 18 |
fn=predict,
|
requirements.txt
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
transformers==4.35.0
|
| 2 |
gradio==5.9.1
|
| 3 |
-
torch==2.
|
| 4 |
-
tokenizers==0.14.1
|
|
|
|
|
|
|
|
|
| 1 |
transformers==4.35.0
|
| 2 |
gradio==5.9.1
|
| 3 |
+
torch==2.6.0
|
| 4 |
+
tokenizers==0.14.1
|
| 5 |
+
tensorflow==2.13.0
|
| 6 |
+
keras==2.13.1
|