SHAMIL SHAHBAZ AWAN
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ if GROQ_API_KEY is None:
|
|
| 11 |
else:
|
| 12 |
groq_client = Groq(api_key=GROQ_API_KEY)
|
| 13 |
|
| 14 |
-
# Step 3: Enhance
|
| 15 |
def enhance_with_groq(query):
|
| 16 |
"""
|
| 17 |
Enhance the suggestions using Groq.
|
|
@@ -34,12 +34,20 @@ else:
|
|
| 34 |
- Affordable internet solutions.
|
| 35 |
- Signal boosting tips.
|
| 36 |
- Offline tools for education, healthcare, and business.
|
|
|
|
| 37 |
""")
|
| 38 |
|
| 39 |
# Sidebar User Inputs
|
| 40 |
st.sidebar.header("Input Your Details")
|
| 41 |
location = st.sidebar.text_input("Enter Your Location (e.g., City, District)")
|
| 42 |
-
needs = st.sidebar.selectbox("What do you need?", [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
# Fetch and Enhance Suggestions
|
| 45 |
if st.sidebar.button("Get Suggestions"):
|
|
@@ -57,3 +65,98 @@ else:
|
|
| 57 |
st.write(groq_response)
|
| 58 |
else:
|
| 59 |
st.warning("Please enter your location to get recommendations.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
else:
|
| 12 |
groq_client = Groq(api_key=GROQ_API_KEY)
|
| 13 |
|
| 14 |
+
# Step 3: Enhance with Groq
|
| 15 |
def enhance_with_groq(query):
|
| 16 |
"""
|
| 17 |
Enhance the suggestions using Groq.
|
|
|
|
| 34 |
- Affordable internet solutions.
|
| 35 |
- Signal boosting tips.
|
| 36 |
- Offline tools for education, healthcare, and business.
|
| 37 |
+
- More!
|
| 38 |
""")
|
| 39 |
|
| 40 |
# Sidebar User Inputs
|
| 41 |
st.sidebar.header("Input Your Details")
|
| 42 |
location = st.sidebar.text_input("Enter Your Location (e.g., City, District)")
|
| 43 |
+
needs = st.sidebar.selectbox("What do you need?", [
|
| 44 |
+
"Internet Provider",
|
| 45 |
+
"Signal Boosting Tips",
|
| 46 |
+
"Offline Tools",
|
| 47 |
+
"Types of Internet Connections",
|
| 48 |
+
"Educational Resources",
|
| 49 |
+
"Energy-Efficient Connectivity Solutions"
|
| 50 |
+
])
|
| 51 |
|
| 52 |
# Fetch and Enhance Suggestions
|
| 53 |
if st.sidebar.button("Get Suggestions"):
|
|
|
|
| 65 |
st.write(groq_response)
|
| 66 |
else:
|
| 67 |
st.warning("Please enter your location to get recommendations.")
|
| 68 |
+
|
| 69 |
+
# New Features
|
| 70 |
+
|
| 71 |
+
# Types of Internet Connections
|
| 72 |
+
def types_of_internet_connections():
|
| 73 |
+
st.subheader("Types of Internet Connections")
|
| 74 |
+
st.markdown("""
|
| 75 |
+
In rural areas, you may encounter various types of internet connections. Each has its pros and cons, depending on your needs:
|
| 76 |
+
|
| 77 |
+
- **Satellite Internet**:
|
| 78 |
+
- Good for remote areas where no other connectivity is available.
|
| 79 |
+
- Pros: Available almost everywhere.
|
| 80 |
+
- Cons: Can be expensive and has higher latency.
|
| 81 |
+
|
| 82 |
+
- **4G/5G LTE**:
|
| 83 |
+
- Increasingly popular in rural areas.
|
| 84 |
+
- Pros: Affordable, high-speed internet.
|
| 85 |
+
- Cons: Coverage may be limited in remote regions.
|
| 86 |
+
|
| 87 |
+
- **Fiber Optic**:
|
| 88 |
+
- The fastest connection type.
|
| 89 |
+
- Pros: Very fast speeds (up to 1 Gbps).
|
| 90 |
+
- Cons: Limited availability in rural areas.
|
| 91 |
+
|
| 92 |
+
- **DSL (Digital Subscriber Line)**:
|
| 93 |
+
- Common in many rural areas.
|
| 94 |
+
- Pros: Reliable, affordable.
|
| 95 |
+
- Cons: Slower speeds compared to fiber or LTE.
|
| 96 |
+
|
| 97 |
+
- **Fixed Wireless**:
|
| 98 |
+
- Uses radio signals to provide internet access.
|
| 99 |
+
- Pros: Available in remote areas, affordable.
|
| 100 |
+
- Cons: Speeds vary based on distance from the tower.
|
| 101 |
+
|
| 102 |
+
- **Dial-Up**:
|
| 103 |
+
- Rarely used nowadays, but still present in some rural areas.
|
| 104 |
+
- Pros: Available anywhere a phone line exists.
|
| 105 |
+
- Cons: Very slow speeds, high latency.
|
| 106 |
+
""")
|
| 107 |
+
|
| 108 |
+
# Educational Resources
|
| 109 |
+
def educational_resources():
|
| 110 |
+
st.subheader("Educational Resources on Internet Connectivity")
|
| 111 |
+
st.markdown("""
|
| 112 |
+
Here are some useful educational resources to help you understand how internet connectivity works and how it can be improved in rural areas:
|
| 113 |
+
|
| 114 |
+
- **Internet Basics**:
|
| 115 |
+
- [How the Internet Works](https://www.explainthatstuff.com/how-the-internet-works.html) – A simple guide to understanding the basics of internet technology.
|
| 116 |
+
|
| 117 |
+
- **Improving Rural Connectivity**:
|
| 118 |
+
- [The State of Rural Broadband](https://www.broadbandnow.com/research/state-of-broadband) – Research on rural broadband and how to improve it.
|
| 119 |
+
|
| 120 |
+
- **Satellite Internet**:
|
| 121 |
+
- [Satellites for Internet](https://www.explainingthecloud.com/satellite-internet/) – A guide to how satellite internet works.
|
| 122 |
+
|
| 123 |
+
- **Wi-Fi Technology**:
|
| 124 |
+
- [How Wi-Fi Works](https://www.wi-fi.org/discover-wi-fi) – Learn about the technology behind Wi-Fi and how it can be optimized.
|
| 125 |
+
|
| 126 |
+
- **Internet Safety**:
|
| 127 |
+
- [Staying Safe Online](https://www.getsafeonline.org/) – A comprehensive resource for understanding internet safety, especially in rural communities where online security might be a concern.
|
| 128 |
+
""")
|
| 129 |
+
|
| 130 |
+
# Energy-Efficient Connectivity Solutions
|
| 131 |
+
def energy_efficient_connectivity():
|
| 132 |
+
st.subheader("Energy-Efficient Connectivity Solutions")
|
| 133 |
+
st.markdown("""
|
| 134 |
+
In rural areas, where power supply can be inconsistent, energy-efficient internet solutions are important. Here are a few options to consider:
|
| 135 |
+
|
| 136 |
+
- **Solar-Powered Internet Solutions**:
|
| 137 |
+
- Many rural areas are turning to solar-powered routers and internet infrastructure to provide a sustainable internet connection.
|
| 138 |
+
- Pros: Green, cost-effective in the long run.
|
| 139 |
+
- Cons: Initial setup costs, weather dependency.
|
| 140 |
+
|
| 141 |
+
- **Energy-Efficient Modems and Routers**:
|
| 142 |
+
- Choose modems and routers that are designed to consume less power, especially if you're running a small community network or a home-based system.
|
| 143 |
+
- Look for Energy Star-certified devices.
|
| 144 |
+
|
| 145 |
+
- **Low Power IoT Devices**:
|
| 146 |
+
- For rural communities that rely on low-cost, low-power internet, Internet of Things (IoT) devices can be energy-efficient.
|
| 147 |
+
- Use IoT to monitor remote areas, for smart agriculture, and more.
|
| 148 |
+
|
| 149 |
+
- **Energy-Efficient Data Centers**:
|
| 150 |
+
- If you are running a local data center in rural areas, look for solutions that use renewable energy (wind, solar) to power your infrastructure.
|
| 151 |
+
|
| 152 |
+
- **Smart Grid Technologies**:
|
| 153 |
+
- Use smart grid technologies to balance energy usage while maintaining a reliable internet connection. These technologies are being adopted in rural areas to improve energy distribution and reduce energy consumption.
|
| 154 |
+
""")
|
| 155 |
+
|
| 156 |
+
# Display Additional Features
|
| 157 |
+
if needs == "Types of Internet Connections":
|
| 158 |
+
types_of_internet_connections()
|
| 159 |
+
elif needs == "Educational Resources":
|
| 160 |
+
educational_resources()
|
| 161 |
+
elif needs == "Energy-Efficient Connectivity Solutions":
|
| 162 |
+
energy_efficient_connectivity()
|