Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -6,7 +6,10 @@ import database
|
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
models.database.Base.metadata.create_all(bind=database.engine)
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Database session dependency
|
| 12 |
def get_db():
|
|
@@ -24,7 +27,7 @@ def create_sentiment_result(sentiment_result: schemas.SentimentResultCreate, tex
|
|
| 24 |
|
| 25 |
try:
|
| 26 |
text_content = text_input
|
| 27 |
-
sentiment_analysis_result =
|
| 28 |
|
| 29 |
# Create a new SentimentResult instance
|
| 30 |
new_sentiment_result = models.SentimentResult(
|
|
|
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
models.database.Base.metadata.create_all(bind=database.engine)
|
| 9 |
+
distilled_student_sentiment_classifier = pipeline(
|
| 10 |
+
model="lxyuan/distilbert-base-multilingual-cased-sentiments-student",
|
| 11 |
+
return_all_scores=True
|
| 12 |
+
)
|
| 13 |
|
| 14 |
# Database session dependency
|
| 15 |
def get_db():
|
|
|
|
| 27 |
|
| 28 |
try:
|
| 29 |
text_content = text_input
|
| 30 |
+
sentiment_analysis_result = distilled_student_sentiment_classifier(text_content)
|
| 31 |
|
| 32 |
# Create a new SentimentResult instance
|
| 33 |
new_sentiment_result = models.SentimentResult(
|