JasmineQiuqiu commited on
Commit
92387b3
1 Parent(s): 7f613e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -20
app.py CHANGED
@@ -1,24 +1,13 @@
1
- from flask import Flask, request, jsonify
2
- from transformers import pipeline
3
 
4
- app = Flask(__name__)
 
5
 
6
- # Load the sentiment analysis model
7
- sentiment_analyzer = pipeline("sentiment-analysis")
8
 
9
- @app.route('/')
10
- def home():
11
- return "Welcome to the Sentiment Analysis API!"
12
 
13
- @app.route('/predict', methods=['POST'])
14
- def predict():
15
- data = request.get_json()
16
- text = data['text']
17
- result = sentiment_analyzer(text)[0]
18
- return jsonify({
19
- 'label': result['label'],
20
- 'score': result['score']
21
- })
22
-
23
- if __name__ == "__main__":
24
- app.run(host='0.0.0.0', port=5000)
 
1
+ import streamlit as st
 
2
 
3
+ # Title of the application
4
+ st.title('Welcome to my Streamlit App!')
5
 
6
+ # Display text
7
+ st.write("This is a simple Streamlit application.")
8
 
9
+ # Display emoji
10
+ st.write("Here's an emoji for you: :smiley:")
 
11
 
12
+ # A placeholder for additional content
13
+ st.write("Use the endpoint /predict to get sentiment analysis results.")