Spaces:
Runtime error
Runtime error
Update app.py
#11
by liangc40 - opened
app.py
CHANGED
|
@@ -43,9 +43,9 @@ def analyse(text):
|
|
| 43 |
outputs = model(input_ids = encoding['input_ids'], attention_mask = encoding['attention_mask'])
|
| 44 |
_, preds = torch.max(outputs, dim=1)
|
| 45 |
face_url = "https://raw.githubusercontent.com/liangc40/ID2223_Sentimental_Analysis_Project/main/Image/"+ str(preds) + ".png"
|
| 46 |
-
r = requests.get(face_url, stream=True)
|
| 47 |
-
img = Image.open(io.BytesIO(r.content))
|
| 48 |
-
|
| 49 |
#print(preds)
|
| 50 |
return img
|
| 51 |
|
|
|
|
| 43 |
outputs = model(input_ids = encoding['input_ids'], attention_mask = encoding['attention_mask'])
|
| 44 |
_, preds = torch.max(outputs, dim=1)
|
| 45 |
face_url = "https://raw.githubusercontent.com/liangc40/ID2223_Sentimental_Analysis_Project/main/Image/"+ str(preds) + ".png"
|
| 46 |
+
# r = requests.get(face_url, stream=True)
|
| 47 |
+
# img = Image.open(io.BytesIO(r.content))
|
| 48 |
+
img = Image.open(requests.get(face_url, stream=True).raw)
|
| 49 |
#print(preds)
|
| 50 |
return img
|
| 51 |
|