Spaces:
Sleeping
Sleeping
File size: 885 Bytes
1e2924d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import random
import keras
import tensorflow as tf
from transformers import AutoTokenizer
from transformers import TFDistilBertModel, AutoConfig
import streamlit as st
from twitter import twitter_model
def main():
st.header('Twitter disater detector')
directory = os.getcwd()
weights_path= directory+"/custom_model.keras"
model_test= twitter_model(weights_path)
input_text=st.text_input("Please enter your sentence:", "type a word")
prediction= np.round(model_test.predict(input_text))
disaster= False
if prediction==1:
disaster= True
if disaster:
st.write("the text: '",input_text, "' means there is a disaster" )
else:
st.write("the text: ",input_text, "means there is NO disaster" )
if __name__ == '__main__':
main() |