Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- README.md +19 -16
- autoguru.py +54 -0
- requirements.txt +3 -0
README.md
CHANGED
|
@@ -1,20 +1,23 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
colorTo: red
|
| 6 |
-
sdk: docker
|
| 7 |
-
app_port: 8501
|
| 8 |
-
tags:
|
| 9 |
-
- streamlit
|
| 10 |
-
pinned: false
|
| 11 |
-
short_description: Streamlit template space
|
| 12 |
-
license: mit
|
| 13 |
---
|
| 14 |
|
| 15 |
-
#
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ποΈ AutoGuru β Your Ultimate Automotive AI Assistant
|
| 2 |
+
|
| 3 |
+
**AutoGuru** is a powerful Streamlit-based AI assistant that provides expert-level information and support for everything related to **cars and motorcycles**. Whether you're an auto enthusiast, a beginner, or a professional, AutoGuru is here to help with instant insights and comparisons.
|
| 4 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
+
## π Features
|
| 8 |
|
| 9 |
+
- π **Vehicle Lookup**: Get detailed specs and histories of bikes and cars
|
| 10 |
+
- π§ **Repair Guidance**: Step-by-step solutions for common maintenance tasks
|
| 11 |
+
- π οΈ **Customization Tips**: Advice on modifications and tuning
|
| 12 |
+
- π° **Latest News**: Stay updated with auto trends, launches, and tech
|
| 13 |
+
- βοΈ **Smart Comparison**: Compare models based on performance, price, and more
|
| 14 |
+
- π **Wikipedia Integration**: Instant fetch of trusted automotive info
|
| 15 |
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
## π¦ Requirements
|
| 19 |
+
|
| 20 |
+
- Python 3.7+
|
| 21 |
+
- streamlit
|
| 22 |
+
- wikipedia
|
| 23 |
+
- (Optional) openai for GPT integration
|
autoguru.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import wikipedia
|
| 3 |
+
import openai
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
# Set your OpenAI API Key here
|
| 7 |
+
openai.api_key = st.secrets["OPENAI_API_KEY"] if "OPENAI_API_KEY" in st.secrets else "your-api-key-here"
|
| 8 |
+
|
| 9 |
+
st.set_page_config(page_title="AutoGuru", page_icon="π")
|
| 10 |
+
st.title("ποΈ AutoGuru β Ask Me Anything!")
|
| 11 |
+
|
| 12 |
+
st.write("I'm your AI assistant for cars, bikes, and anything else you'd like to know.")
|
| 13 |
+
|
| 14 |
+
# Sidebar with example questions
|
| 15 |
+
with st.sidebar:
|
| 16 |
+
st.subheader("π‘ Try asking:")
|
| 17 |
+
st.markdown("- What is a turbocharger?")
|
| 18 |
+
st.markdown("- How does ABS work?")
|
| 19 |
+
st.markdown("- Who invented the motorcycle?")
|
| 20 |
+
st.markdown("- How to boost mileage of a bike?")
|
| 21 |
+
st.markdown("- What is Python used for?")
|
| 22 |
+
|
| 23 |
+
# Question input
|
| 24 |
+
user_input = st.text_input("π Ask your question:")
|
| 25 |
+
|
| 26 |
+
# Ask GPT (OpenAI)
|
| 27 |
+
def ask_gpt(question):
|
| 28 |
+
try:
|
| 29 |
+
response = openai.ChatCompletion.create(
|
| 30 |
+
model="gpt-3.5-turbo", # or "gpt-4" if you have access
|
| 31 |
+
messages=[
|
| 32 |
+
{"role": "system", "content": "You are AutoGuru, an expert AI assistant in automobiles and general knowledge."},
|
| 33 |
+
{"role": "user", "content": question}
|
| 34 |
+
]
|
| 35 |
+
)
|
| 36 |
+
return response['choices'][0]['message']['content'].strip()
|
| 37 |
+
except Exception as e:
|
| 38 |
+
return f"Error: {e}"
|
| 39 |
+
|
| 40 |
+
# Try Wikipedia first
|
| 41 |
+
def ask_wikipedia(question):
|
| 42 |
+
try:
|
| 43 |
+
return wikipedia.summary(question, sentences=3)
|
| 44 |
+
except:
|
| 45 |
+
return None
|
| 46 |
+
|
| 47 |
+
# Answer Logic
|
| 48 |
+
if user_input:
|
| 49 |
+
with st.spinner("Thinking..."):
|
| 50 |
+
answer = ask_wikipedia(user_input)
|
| 51 |
+
if not answer:
|
| 52 |
+
answer = ask_gpt(user_input)
|
| 53 |
+
st.success("β
Answer:")
|
| 54 |
+
st.write(answer)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
openai
|
| 3 |
+
wikipedia
|