Spaces:
Runtime error
Runtime error
Commit
·
92d7f67
1
Parent(s):
a36ecb4
undo
Browse files
app.py
CHANGED
@@ -1,31 +1,8 @@
|
|
1 |
-
|
2 |
-
# from transformers import pipeline
|
3 |
-
# pipe = pipeline('sentiment-analysis')
|
4 |
-
# text = st.text_area('enter some text!')
|
5 |
-
|
6 |
-
# if text:
|
7 |
-
# out = pipe(text)
|
8 |
-
# st.write(out)
|
9 |
-
|
10 |
-
# My Flask App
|
11 |
-
import json
|
12 |
-
from flask import Flask, request, jsonify
|
13 |
from transformers import pipeline
|
14 |
-
|
15 |
-
app = Flask(__name__)
|
16 |
-
|
17 |
pipe = pipeline('sentiment-analysis')
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
text = data['text']
|
23 |
-
|
24 |
-
if text:
|
25 |
-
out = pipe(text)
|
26 |
-
return jsonify(out)
|
27 |
-
else:
|
28 |
-
return jsonify({"error": "No text provided."}), 400
|
29 |
-
|
30 |
-
if __name__ == '__main__':
|
31 |
-
app.run()
|
|
|
1 |
+
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from transformers import pipeline
|
|
|
|
|
|
|
3 |
pipe = pipeline('sentiment-analysis')
|
4 |
+
text = st.text_area('enter some text!')
|
5 |
|
6 |
+
if text:
|
7 |
+
out = pipe(text)
|
8 |
+
st.write(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|