Spaces:
Runtime error
Runtime error
Sentiment Analysys
Browse files- app.py +34 -0
- bitcoin.png +0 -0
- requirements.txt +6 -0
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import tensorflow as tf
|
| 3 |
+
from tensorflow import keras
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import numpy as np
|
| 6 |
+
from PIL import Image
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from tensorflow.keras.models import load_model
|
| 10 |
+
|
| 11 |
+
st.set_page_config(page_title = 'Sentiment Analysis Bitcoin',
|
| 12 |
+
initial_sidebar_state = "expanded",
|
| 13 |
+
menu_items = {
|
| 14 |
+
'About' : 'Milestone 2 Fase 2'
|
| 15 |
+
})
|
| 16 |
+
|
| 17 |
+
image = Image.open('bitcoin.png')
|
| 18 |
+
|
| 19 |
+
# load model
|
| 20 |
+
model = keras.models.load_model("model_bitcoin")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
label = ['Negative', 'Neutral', 'Positive']
|
| 24 |
+
|
| 25 |
+
st.title("Sentiment Analysis Bitcoin")
|
| 26 |
+
st.image(image)
|
| 27 |
+
|
| 28 |
+
news_title = st.text_input('Enter a Tweet Bitcoin')
|
| 29 |
+
new_data = pd.DataFrame([news_title])
|
| 30 |
+
res = model.predict(new_data)
|
| 31 |
+
res = res.argmax()
|
| 32 |
+
press = st.button('Predict')
|
| 33 |
+
if press:
|
| 34 |
+
st.title(label[res])
|
bitcoin.png
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
numpy
|
| 4 |
+
scipy
|
| 5 |
+
tensorflow-cpu
|
| 6 |
+
scikit-learn == 1.0.2
|