Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,27 @@ import gradio as gr
|
|
2 |
from sentence_transformers import SentenceTransformer, util
|
3 |
import openai
|
4 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
|
|
6 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
7 |
|
8 |
# Initialize paths and model identifiers for easy configuration and maintenance
|
|
|
2 |
from sentence_transformers import SentenceTransformer, util
|
3 |
import openai
|
4 |
import os
|
5 |
+
#trying so when user puts la or los angles specific pic comes:
|
6 |
+
import gradio as gr
|
7 |
+
|
8 |
+
# URL or path to your image file
|
9 |
+
PICTURE_URL = "https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.viator.com%2Fblog%2FLos-Angeles-Neighborhood-Guide%2Fl28613&psig=AOvVaw373cy7Ol0Un2ZFwQhyhQCW&ust=1722567700903000&source=images&cd=vfe&opi=89978449&ved=0CBEQjRxqFwoTCOj2x_Hm0ocDFQAAAAAdAAAAABAM"
|
10 |
+
|
11 |
+
def respond(user_input):
|
12 |
+
if "los angeles" in user_input.lower() or "la" in user_input.lower():
|
13 |
+
return f"Here's a picture of Los Angeles!", PICTURE_URL
|
14 |
+
else:
|
15 |
+
return "How can I help you with astronomy?", None
|
16 |
+
|
17 |
+
# Define the Gradio interface
|
18 |
+
iface = gr.Interface(
|
19 |
+
fn=respond,
|
20 |
+
inputs="text",
|
21 |
+
outputs=["text", "image"]
|
22 |
+
)
|
23 |
|
24 |
+
# Launch the interface
|
25 |
+
iface.launch()
|
26 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
27 |
|
28 |
# Initialize paths and model identifiers for easy configuration and maintenance
|