Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,23 +5,23 @@ import os
|
|
| 5 |
#trying so when user puts la or los angles specific pic comes:
|
| 6 |
|
| 7 |
# URL or path to your image file
|
| 8 |
-
PICTURE_URL = "Stars/sf.png"
|
| 9 |
|
| 10 |
-
def respond(user_input):
|
| 11 |
-
|
| 12 |
-
return f"Here's a picture of Los Angeles!", PICTURE_URL
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
# Define the Gradio interface
|
| 17 |
-
iface = gr.Interface(
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
)
|
| 22 |
|
| 23 |
# Launch the interface
|
| 24 |
-
iface.launch()
|
| 25 |
|
| 26 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
| 27 |
|
|
@@ -30,9 +30,9 @@ filename = "output_topic_details.txt" # Path to the file storing chess-specific
|
|
| 30 |
retrieval_model_name = 'output/sentence-transformer-finetuned/'
|
| 31 |
|
| 32 |
# Define paths to images
|
| 33 |
-
path_to_sf_image = "
|
| 34 |
-
path_to_sacramento_image = "
|
| 35 |
-
path_to_la_image = "
|
| 36 |
|
| 37 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 38 |
|
|
@@ -129,11 +129,11 @@ def query_model(question):
|
|
| 129 |
return "Welcome to Starfinder! Ask me anything about outer space, stargazing, and upcoming astronomical events.", None
|
| 130 |
|
| 131 |
if "san francisco" in question.lower():
|
| 132 |
-
return "
|
| 133 |
if "sacramento" in question.lower():
|
| 134 |
-
return "
|
| 135 |
if "los angeles" in question.lower() or "la" in question.lower():
|
| 136 |
-
return "
|
| 137 |
|
| 138 |
relevant_segment = find_relevant_segment(question, segments)
|
| 139 |
if not relevant_segment:
|
|
@@ -141,6 +141,7 @@ def query_model(question):
|
|
| 141 |
response = generate_response(question, relevant_segment)
|
| 142 |
return response, None
|
| 143 |
|
|
|
|
| 144 |
# Define the welcome message and specific topics the chatbot can provide information about
|
| 145 |
welcome_message = """
|
| 146 |
# ✧ Welcome to Starfinder!
|
|
|
|
| 5 |
#trying so when user puts la or los angles specific pic comes:
|
| 6 |
|
| 7 |
# URL or path to your image file
|
| 8 |
+
#PICTURE_URL = "Stars/sf.png"
|
| 9 |
|
| 10 |
+
#def respond(user_input):
|
| 11 |
+
# if "los angeles" in user_input.lower() or "la" in user_input.lower():
|
| 12 |
+
#return f"Here's a picture of Los Angeles!", PICTURE_URL
|
| 13 |
+
# else:
|
| 14 |
+
# return "How can I help you with astronomy?", None
|
| 15 |
|
| 16 |
# Define the Gradio interface
|
| 17 |
+
#iface = gr.Interface(
|
| 18 |
+
# fn=respond,
|
| 19 |
+
# inputs="text",
|
| 20 |
+
# outputs=["text", "image"]
|
| 21 |
+
#)
|
| 22 |
|
| 23 |
# Launch the interface
|
| 24 |
+
#iface.launch()
|
| 25 |
|
| 26 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
| 27 |
|
|
|
|
| 30 |
retrieval_model_name = 'output/sentence-transformer-finetuned/'
|
| 31 |
|
| 32 |
# Define paths to images
|
| 33 |
+
path_to_sf_image = "Stars/sf.png"
|
| 34 |
+
path_to_sacramento_image = "Stars/sacramento.png"
|
| 35 |
+
path_to_la_image = "Stars/la.png"
|
| 36 |
|
| 37 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 38 |
|
|
|
|
| 129 |
return "Welcome to Starfinder! Ask me anything about outer space, stargazing, and upcoming astronomical events.", None
|
| 130 |
|
| 131 |
if "san francisco" in question.lower():
|
| 132 |
+
return "There are many locations near San Francisco where you can stargaze: Lick Observatory (Mount Hamilton), Chabot Space & Science Center (Oakland) , Twin Peaks (SF), Sibley Volcanic National Reserve (Oakland), Mount Tamalpais (Marin), San Francisco State University Observatory (SF), Mount Diablo (East Bay)!", path_to_sf_image
|
| 133 |
if "sacramento" in question.lower():
|
| 134 |
+
return "There are many locations near Sacramento where you can stargaze: Kalithea Park, Northstar Park, Curtis Park, Lake Theodore, Casa Bella Verde, McKinley Park, Tiscornia Park, Old Sacramento Waterfront.", path_to_sacramento_image
|
| 135 |
if "los angeles" in question.lower() or "la" in question.lower():
|
| 136 |
+
return "There are many locations near Los Angeles where you can stargaze: Leo Carrillo State Beach (Malibu), Malibu Creek State Park (Malibu), Griffith Observatory (Griffith Park), Mount Wilson Observatory (Angeles Crest)", path_to_la_image
|
| 137 |
|
| 138 |
relevant_segment = find_relevant_segment(question, segments)
|
| 139 |
if not relevant_segment:
|
|
|
|
| 141 |
response = generate_response(question, relevant_segment)
|
| 142 |
return response, None
|
| 143 |
|
| 144 |
+
|
| 145 |
# Define the welcome message and specific topics the chatbot can provide information about
|
| 146 |
welcome_message = """
|
| 147 |
# ✧ Welcome to Starfinder!
|