Manishkumaryadav commited on
Commit
e14d536
Β·
verified Β·
1 Parent(s): 908772f

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -61
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.")