Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,14 @@ client = OpenAI(api_key=api_key)
|
|
22 |
# Set up NASA ADS token
|
23 |
ADS.TOKEN = os.getenv('ADS_API_KEY') # Ensure your ADS API key is stored in environment variables
|
24 |
|
25 |
-
# Define
|
26 |
-
system_message = "
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
def encode_text(text):
|
29 |
inputs = bi_tokenizer(text, return_tensors='pt', padding=True, truncation=True, max_length=128)
|
@@ -110,7 +116,7 @@ def generate_response(user_input, relevant_context="", references=[], max_tokens
|
|
110 |
|
111 |
return response.choices[0].message.content.strip()
|
112 |
|
113 |
-
def generate_data_insights(user_input, exoplanet_data, max_tokens=
|
114 |
"""
|
115 |
Generate insights by passing the user's input along with the exoplanet data to GPT-4.
|
116 |
"""
|
@@ -231,7 +237,7 @@ iface = gr.Interface(
|
|
231 |
gr.File(label="Download SCDD", type="filepath"),
|
232 |
gr.Dataframe(label="Exoplanet Data Table")
|
233 |
],
|
234 |
-
title="ExosAI - NASA SMD SCDD AI Assistant [version-0.
|
235 |
description="ExosAI is an AI-powered assistant for generating and visualising HWO Science Cases",
|
236 |
)
|
237 |
|
|
|
22 |
# Set up NASA ADS token
|
23 |
ADS.TOKEN = os.getenv('ADS_API_KEY') # Ensure your ADS API key is stored in environment variables
|
24 |
|
25 |
+
# Define system message with instructions
|
26 |
+
system_message = """
|
27 |
+
You are ExosAI, a helpful assistant specializing in Exoplanet research.
|
28 |
+
Your goal is to provide detailed, structured answers by following these guidelines:
|
29 |
+
- The central topic branches out into 3 science objectives.
|
30 |
+
- Each science objective branches out into 2 physical parameters, and each physical parameter branches out into 2 observables.
|
31 |
+
- Include details, provide scientific references, and make recommendations for observation parameters like wavelength, resolution, etc.
|
32 |
+
"""
|
33 |
|
34 |
def encode_text(text):
|
35 |
inputs = bi_tokenizer(text, return_tensors='pt', padding=True, truncation=True, max_length=128)
|
|
|
116 |
|
117 |
return response.choices[0].message.content.strip()
|
118 |
|
119 |
+
def generate_data_insights(user_input, exoplanet_data, max_tokens=500, temperature=0.3):
|
120 |
"""
|
121 |
Generate insights by passing the user's input along with the exoplanet data to GPT-4.
|
122 |
"""
|
|
|
237 |
gr.File(label="Download SCDD", type="filepath"),
|
238 |
gr.Dataframe(label="Exoplanet Data Table")
|
239 |
],
|
240 |
+
title="ExosAI - NASA SMD SCDD AI Assistant [version-0.5a]",
|
241 |
description="ExosAI is an AI-powered assistant for generating and visualising HWO Science Cases",
|
242 |
)
|
243 |
|