Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,32 +13,11 @@ def google_search_query(question):
|
|
| 13 |
# Define the Google Search Tool
|
| 14 |
google_search_tool = Tool(google_search=GoogleSearch())
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
contents=question,
|
| 20 |
-
config=GenerateContentConfig(tools=[google_search_tool]),
|
| 21 |
-
)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
return ai_response, search_results
|
| 28 |
-
except Exception as e:
|
| 29 |
-
return f"Error: {str(e)}", ""
|
| 30 |
-
|
| 31 |
-
# Gradio Interface
|
| 32 |
-
app = gr.Interface(
|
| 33 |
-
fn=google_search_query,
|
| 34 |
-
inputs=gr.Textbox(lines=2, label="Ask a Question"),
|
| 35 |
-
outputs=[
|
| 36 |
-
gr.Textbox(label="AI Response"),
|
| 37 |
-
gr.HTML(label="Search Results"),
|
| 38 |
-
],
|
| 39 |
-
title="Google Search with Gemini AI",
|
| 40 |
-
description="Ask a question, and the AI will use Google search tools to provide an answer along with contextual search results.",
|
| 41 |
-
)
|
| 42 |
-
|
| 43 |
-
if __name__ == "__main__":
|
| 44 |
-
app.launch(share=True)
|
|
|
|
| 13 |
# Define the Google Search Tool
|
| 14 |
google_search_tool = Tool(google_search=GoogleSearch())
|
| 15 |
|
| 16 |
+
# Make the prompt specific to perfumes and their production
|
| 17 |
+
perfume_prompt = f"""
|
| 18 |
+
You are an expert perfumer and fragrance chemist.
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
Answer the following question strictly in the context of:
|
| 21 |
+
- Perfumes and fragrances
|
| 22 |
+
- Perfume production and formulation
|
| 23 |
+
- Raw
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|