Aytaj commited on
Commit
62b4437
1 Parent(s): ef8808f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -16
app.py CHANGED
@@ -1,23 +1,20 @@
1
  import streamlit as st
2
  from transformers import pipeline
 
3
 
4
- # Load the text classification pipeline for sentiment analysis
5
- fake_news_detector = pipeline("text-classification", model="distilroberta-base-finetuned-fake-news-detection")
 
6
 
7
- # Streamlit app
8
- st.title("Fake News Detector")
9
 
10
- # Input text box for user-provided news article
11
- news_article = st.text_area("Enter the news article:", "")
 
12
 
13
- # Check fake news button
14
- if st.button("Check Fake News"):
15
- if news_article:
16
- # Perform fake news detection
17
- result = fake_news_detector(news_article)[0]
18
 
19
- # Display result
20
- st.subheader("Result:")
21
- st.write(f"Label: {result['label']}, Confidence: {result['score']:.2f}")
22
- else:
23
- st.warning("Please enter a news article for analysis.")
 
1
  import streamlit as st
2
  from transformers import pipeline
3
+ pipe = pipeline('text-generation', model='Pclanglais/MonadGPT', device='cuda')
4
 
5
+ def main():
6
+ st.title("MonadGPT Streamlit App")
7
+ st.markdown("This is a streamlit app that allows you to have a conversation abbout any topic")
8
 
9
+ user_input = st.text_input("Your question:")
 
10
 
11
+ if user_input:
12
+ response = pipe(user_input, max_length=256, do_sample=True, top_k=50, top_p=0.95, early_stopping=True)
13
+ st.write(response[0]['generated_text'])
14
 
15
+ if st.button("Restart"):
16
+ st.empty()
17
+
18
+ if __name__ == "__main__":
19
+ main()
20