Create project
Browse files
project
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import streamlit as st
|
| 3 |
+
def generate(str):
|
| 4 |
+
pipe = pipeline("text-generation", model="huggingtweets/cryptoanglio")
|
| 5 |
+
story_txt = pipe(str)[0]['generated_text']
|
| 6 |
+
|
| 7 |
+
print(story_txt)
|
| 8 |
+
return story_txt
|
| 9 |
+
|
| 10 |
+
def classify(str):
|
| 11 |
+
pipe = pipeline("text-classification", model="yzhangqs/Finace_news")
|
| 12 |
+
result=pipe(str)
|
| 13 |
+
print(result[0]['label'])
|
| 14 |
+
return result[0]['label']
|
| 15 |
+
|
| 16 |
+
def main():
|
| 17 |
+
st.set_page_config(page_title="A Crypto News Generation Robots", page_icon="🦜")
|
| 18 |
+
#st.header("Choose Positive or Negative")
|
| 19 |
+
#choice = st.text_input("Import your choice")
|
| 20 |
+
st.header("Import text here: ")
|
| 21 |
+
input_text =st.text_input("Import your text")
|
| 22 |
+
|
| 23 |
+
if input_text is not None:
|
| 24 |
+
print(input_text)
|
| 25 |
+
st.text('Generating the news....')
|
| 26 |
+
news = generate(input_text)
|
| 27 |
+
st.write(news)
|
| 28 |
+
|
| 29 |
+
st.text('The predicted Trend is')
|
| 30 |
+
label = classify(news)
|
| 31 |
+
st.write(label)
|
| 32 |
+
|
| 33 |
+
if __name__ == "__main__":
|
| 34 |
+
main()
|