AsthanM commited on
Commit
d14bc2b
Β·
verified Β·
1 Parent(s): b1700a4

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -49
app.py DELETED
@@ -1,49 +0,0 @@
1
- import streamlit as st
2
- import requests
3
- import os
4
- import streamlit as st
5
- st.title("βœ… App Loaded Successfully!")
6
- # Set page
7
- st.set_page_config(page_title="Product Comparison LLM", layout="wide")
8
- st.title("🧠 Competitive Product Analyser")
9
-
10
- # Hugging Face API setup
11
- API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-large"
12
- HF_TOKEN = os.getenv("HF_TOKEN") # <-- Secure way if you set secret key
13
- headers = {"Authorization": f"Bearer {HF_TOKEN}"}
14
-
15
- # Text input boxes
16
- product1 = st.text_area("πŸ“¦ Product/Service 1", height=200)
17
- product2 = st.text_area("πŸ“¦ Product/Service 2", height=200)
18
-
19
- # Button
20
- if st.button("πŸ” Analyze"):
21
- with st.spinner("Contacting model..."):
22
- prompt = f"""
23
- Compare the following two products or services:
24
-
25
- Product/Service 1:
26
- {product1}
27
-
28
- Product/Service 2:
29
- {product2}
30
-
31
- Your task:
32
- - Provide a detailed feature-by-feature comparison.
33
- - Perform a SWOT analysis (Strengths, Weaknesses, Opportunities, Threats) for each.
34
- - Highlight key differentiators and insights in a business-focused summary.
35
- - Use markdown formatting for readability.
36
- """
37
- response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
38
-
39
- st.subheader("πŸ“‘ API Response Debug")
40
- st.write("Status Code:", response.status_code)
41
- st.write("Raw:", response.text)
42
-
43
- try:
44
- result = response.json()
45
- output = result[0]["generated_text"] if isinstance(result, list) else str(result)
46
- st.markdown("### πŸ“„ Result:")
47
- st.markdown(output)
48
- except Exception as e:
49
- st.error(f"❌ Failed to parse response: {e}")