Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Delete app.py
Browse files
    	
        app.py
    DELETED
    
    | 
         @@ -1,61 +0,0 @@ 
     | 
|
| 1 | 
         
            -
            import streamlit as st
         
     | 
| 2 | 
         
            -
            import requests
         
     | 
| 3 | 
         
            -
            import pandas as pd
         
     | 
| 4 | 
         
            -
             
     | 
| 5 | 
         
            -
            # β
 Replace with your Hugging Face backend URL
         
     | 
| 6 | 
         
            -
            # β
 Use the deployed backend Space URL
         
     | 
| 7 | 
         
            -
            BACKEND_URL = "https://Manishkumaryadav-news-summarize.hf.space/analyze" 
         
     | 
| 8 | 
         
            -
             
     | 
| 9 | 
         
            -
             
     | 
| 10 | 
         
            -
            st.title("π News Sentiment Analysis & TTS in Hindi")
         
     | 
| 11 | 
         
            -
             
     | 
| 12 | 
         
            -
            # Input field for company name
         
     | 
| 13 | 
         
            -
            company_name = st.text_input("Enter Company Name", "")
         
     | 
| 14 | 
         
            -
             
     | 
| 15 | 
         
            -
            if st.button("Analyze"):
         
     | 
| 16 | 
         
            -
                if not company_name:
         
     | 
| 17 | 
         
            -
                    st.warning("β οΈ Please enter a company name.")
         
     | 
| 18 | 
         
            -
                else:
         
     | 
| 19 | 
         
            -
                    st.info(f"π Analyzing news for {company_name}...")
         
     | 
| 20 | 
         
            -
             
     | 
| 21 | 
         
            -
                    # Send request to Flask backend
         
     | 
| 22 | 
         
            -
                    response = requests.post(
         
     | 
| 23 | 
         
            -
                        BACKEND_URL,
         
     | 
| 24 | 
         
            -
                        json={"company_name": company_name}
         
     | 
| 25 | 
         
            -
                    )
         
     | 
| 26 | 
         
            -
             
     | 
| 27 | 
         
            -
                    if response.status_code == 200:
         
     | 
| 28 | 
         
            -
                        data = response.json()
         
     | 
| 29 | 
         
            -
             
     | 
| 30 | 
         
            -
                        st.success("β
 Analysis Complete!")
         
     | 
| 31 | 
         
            -
             
     | 
| 32 | 
         
            -
                        # β
 Display Sentiment Summary
         
     | 
| 33 | 
         
            -
                        st.subheader("π Sentiment Summary")
         
     | 
| 34 | 
         
            -
                        st.json(data["sentiment_summary"])
         
     | 
| 35 | 
         
            -
             
     | 
| 36 | 
         
            -
                        # β
 Display Articles
         
     | 
| 37 | 
         
            -
                        st.subheader("π° Extracted Articles")
         
     | 
| 38 | 
         
            -
                        
         
     | 
| 39 | 
         
            -
                        df = pd.DataFrame(data["articles"])
         
     | 
| 40 | 
         
            -
                        
         
     | 
| 41 | 
         
            -
                        for _, article in df.iterrows():
         
     | 
| 42 | 
         
            -
                            st.markdown(f"### [{article['title']}]({article['url']})")
         
     | 
| 43 | 
         
            -
                            st.write(f"**Summary:** {article['summary']}")
         
     | 
| 44 | 
         
            -
                            st.write("---")
         
     | 
| 45 | 
         
            -
             
     | 
| 46 | 
         
            -
                        # β
 Display Hindi TTS Audio
         
     | 
| 47 | 
         
            -
                        st.subheader("π Hindi TTS Audio Output")
         
     | 
| 48 | 
         
            -
             
     | 
| 49 | 
         
            -
                        audio_file_url = f"{BACKEND_URL}/{data['audio_file']}"
         
     | 
| 50 | 
         
            -
                        
         
     | 
| 51 | 
         
            -
                        st.audio(audio_file_url, format="audio/mp3")
         
     | 
| 52 | 
         
            -
             
     | 
| 53 | 
         
            -
                        st.download_button(
         
     | 
| 54 | 
         
            -
                            label="β¬οΈ Download Hindi TTS Audio",
         
     | 
| 55 | 
         
            -
                            data=requests.get(audio_file_url).content,
         
     | 
| 56 | 
         
            -
                            file_name=f"{company_name}_TTS.mp3",
         
     | 
| 57 | 
         
            -
                            mime="audio/mpeg"
         
     | 
| 58 | 
         
            -
                        )
         
     | 
| 59 | 
         
            -
                        
         
     | 
| 60 | 
         
            -
                    else:
         
     | 
| 61 | 
         
            -
                        st.error("β Error analyzing news. Please try again.")
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         |