Download app.py from Celiasy/project: direct link, hf CLI and curl.
- Browser
- Download file 951 Bytes
-
https://huggingface.co/spaces/Celiasy/project/resolve/main/app.py
- Command line
-
hf download hf://spaces/Celiasy/project/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Celiasy/project/resolve/main/app.py
951 Bytes
| 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() |