aquibmoin commited on
Commit
e86985c
1 Parent(s): f5f2b08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -193,12 +193,20 @@ def generate_data_insights(user_input, exoplanet_data, max_tokens=500, temperatu
193
  return data_insights
194
 
195
 
196
- def export_to_word(response_content):
197
  doc = Document()
198
 
199
  # Add a title (optional, you can remove this if not needed)
200
  doc.add_heading('AI Generated SCDD', 0)
201
 
 
 
 
 
 
 
 
 
202
  # Split the response into sections based on ### headings
203
  sections = response_content.split('### ')
204
 
@@ -311,7 +319,7 @@ def chatbot(user_input, context="", use_encoder=False, max_tokens=150, temperatu
311
  response = generate_response(user_input, relevant_context, references, max_tokens, temperature, top_p, frequency_penalty, presence_penalty)
312
 
313
  # Export the response to a Word document
314
- word_doc_path = export_to_word(response)
315
 
316
  # Fetch exoplanet data
317
  exoplanet_data = fetch_exoplanet_data()
 
193
  return data_insights
194
 
195
 
196
+ def export_to_word(response_content, subdomain_definition, science_goal):
197
  doc = Document()
198
 
199
  # Add a title (optional, you can remove this if not needed)
200
  doc.add_heading('AI Generated SCDD', 0)
201
 
202
+ # Insert the Subdomain Definition at the top
203
+ doc.add_heading('Subdomain Definition:', level=1)
204
+ doc.add_paragraph(subdomain_definition)
205
+
206
+ # Insert the Science Goal at the top
207
+ doc.add_heading('Science Goal:', level=1)
208
+ doc.add_paragraph(science_goal)
209
+
210
  # Split the response into sections based on ### headings
211
  sections = response_content.split('### ')
212
 
 
319
  response = generate_response(user_input, relevant_context, references, max_tokens, temperature, top_p, frequency_penalty, presence_penalty)
320
 
321
  # Export the response to a Word document
322
+ word_doc_path = export_to_word(response, user_input, context)
323
 
324
  # Fetch exoplanet data
325
  exoplanet_data = fetch_exoplanet_data()