| 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() |