File size: 951 Bytes
cbce0f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from transformers import pipeline
import streamlit as st
def generate(str):
  pipe = pipeline("text-generation", model="huggingtweets/cryptoanglio")
  story_txt = pipe(str)[0]['generated_text']

  print(story_txt)
  return story_txt

def classify(str):
  pipe = pipeline("text-classification", model="yzhangqs/Finace_news")
  result=pipe(str)
  print(result[0]['label'])
  return result[0]['label']

def main():
  st.set_page_config(page_title="A Crypto News Generation Robots", page_icon="🦜")
  #st.header("Choose Positive or Negative")
  #choice = st.text_input("Import your choice")
  st.header("Import text here: ")
  input_text =st.text_input("Import your text")

  if input_text is not None:
      print(input_text)
      st.text('Generating the news....')
      news = generate(input_text)
      st.write(news)

      st.text('The predicted Trend is')
      label = classify(news)
      st.write(label)

if __name__ == "__main__":
    main()