Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -254,7 +254,7 @@ def generate_data_insights(user_input, exoplanet_data, max_tokens=500, temperatu
|
|
254 |
return data_insights
|
255 |
|
256 |
|
257 |
-
def export_to_word(response_content, subdomain_definition, science_goal
|
258 |
doc = Document()
|
259 |
|
260 |
# Add a title (optional, you can remove this if not needed)
|
@@ -268,11 +268,6 @@ def export_to_word(response_content, subdomain_definition, science_goal, science
|
|
268 |
doc.add_heading('Science Goal:', level=1)
|
269 |
doc.add_paragraph(science_goal)
|
270 |
|
271 |
-
# Insert Science Objectives if provided
|
272 |
-
if science_objectives.strip():
|
273 |
-
doc.add_heading('Science Objectives (User-Defined):', level=1)
|
274 |
-
doc.add_paragraph(science_objectives)
|
275 |
-
|
276 |
# Split the response into sections based on ### headings
|
277 |
sections = response_content.split('### ')
|
278 |
|
@@ -398,7 +393,7 @@ def chatbot(user_input, science_objectives="", context="", subdomain="", use_enc
|
|
398 |
response = f"### Science Objectives (User-Defined):\n{science_objectives}\n\n" + response
|
399 |
|
400 |
# Export the response to a Word document
|
401 |
-
word_doc_path = export_to_word(response, subdomain, user_input
|
402 |
|
403 |
# Fetch exoplanet data
|
404 |
exoplanet_data = fetch_exoplanet_data()
|
|
|
254 |
return data_insights
|
255 |
|
256 |
|
257 |
+
def export_to_word(response_content, subdomain_definition, science_goal):
|
258 |
doc = Document()
|
259 |
|
260 |
# Add a title (optional, you can remove this if not needed)
|
|
|
268 |
doc.add_heading('Science Goal:', level=1)
|
269 |
doc.add_paragraph(science_goal)
|
270 |
|
|
|
|
|
|
|
|
|
|
|
271 |
# Split the response into sections based on ### headings
|
272 |
sections = response_content.split('### ')
|
273 |
|
|
|
393 |
response = f"### Science Objectives (User-Defined):\n{science_objectives}\n\n" + response
|
394 |
|
395 |
# Export the response to a Word document
|
396 |
+
word_doc_path = export_to_word(response, subdomain, user_input)
|
397 |
|
398 |
# Fetch exoplanet data
|
399 |
exoplanet_data = fetch_exoplanet_data()
|