Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
|
|
|
| 3 |
|
| 4 |
# Load your pre-trained model
|
| 5 |
model = pipeline("text-classification", model="i0xs0/Text_Classifiction", tokenizer="i0xs0/Text_Classifiction")
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
results = model(text)
|
| 11 |
return {item["label"]: item["score"] for item in results}
|
| 12 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
# Load your pre-trained model
|
| 6 |
model = pipeline("text-classification", model="i0xs0/Text_Classifiction", tokenizer="i0xs0/Text_Classifiction")
|
| 7 |
|
| 8 |
+
if not os.path.exists(".logs"):
|
| 9 |
+
os.makedirs(".logs")
|
| 10 |
|
| 11 |
+
def predict_emotion(text):
|
| 12 |
+
|
| 13 |
+
with open(".logs/user_logs.txt", "a") as log_file:
|
| 14 |
+
log_file.write(f"User input: {text}\n")
|
| 15 |
results = model(text)
|
| 16 |
return {item["label"]: item["score"] for item in results}
|
| 17 |
|