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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -42,7 +42,7 @@ Generate a detailed structured response based on the following science context a
42
  Description of Desired Observations: Detail the types of observations related to the science context and user input.
43
 
44
  Technical Requirements Table: Generate a table with the following columns:
45
- - Requirements: The specific observational requirements (e.g., UV observations, Optical observations or Infrared observations).
46
  - Necessary: The necessary values or parameters (e.g., wavelength ranges, spatial resolution).
47
  - Desired: The desired values or parameters.
48
  - Justification: A scientific explanation of why these requirements are important.
@@ -305,7 +305,7 @@ def gpt_response_to_dataframe(gpt_response):
305
  df = pd.DataFrame(rows, columns=headers)
306
  return df
307
 
308
- def chatbot(user_input, context="", use_encoder=False, max_tokens=150, temperature=0.7, top_p=0.9, frequency_penalty=0.5, presence_penalty=0.0):
309
  if use_encoder and context:
310
  context_texts = context.split("\n")
311
  relevant_context = retrieve_relevant_context(user_input, context_texts)
@@ -313,13 +313,13 @@ def chatbot(user_input, context="", use_encoder=False, max_tokens=150, temperatu
313
  relevant_context = ""
314
 
315
  # Fetch NASA ADS references using the full prompt
316
- references = fetch_nasa_ads_references(user_input)
317
 
318
  # Generate response from GPT-4
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()
@@ -371,8 +371,9 @@ def chatbot(user_input, context="", use_encoder=False, max_tokens=150, temperatu
371
  iface = gr.Interface(
372
  fn=chatbot,
373
  inputs=[
374
- gr.Textbox(lines=2, placeholder="Define your Subdomain...", label="Subdomain Definition"),
375
  gr.Textbox(lines=5, placeholder="Enter your Science Goal...", label="Science Goal"),
 
 
376
  gr.Checkbox(label="Use NASA SMD Bi-Encoder for Context"),
377
  gr.Slider(50, 2000, value=150, step=10, label="Max Tokens"),
378
  gr.Slider(0.0, 1.0, value=0.7, step=0.1, label="Temperature"),
 
42
  Description of Desired Observations: Detail the types of observations related to the science context and user input.
43
 
44
  Technical Requirements Table: Generate a table with the following columns:
45
+ - Requirements: The specific observational requirements (e.g., UV observations, Optical observations or Infrared observations. No radio or radar).
46
  - Necessary: The necessary values or parameters (e.g., wavelength ranges, spatial resolution).
47
  - Desired: The desired values or parameters.
48
  - Justification: A scientific explanation of why these requirements are important.
 
305
  df = pd.DataFrame(rows, columns=headers)
306
  return df
307
 
308
+ def chatbot(user_input, context="", subdomain="", use_encoder=False, max_tokens=150, temperature=0.7, top_p=0.9, frequency_penalty=0.5, presence_penalty=0.0):
309
  if use_encoder and context:
310
  context_texts = context.split("\n")
311
  relevant_context = retrieve_relevant_context(user_input, context_texts)
 
313
  relevant_context = ""
314
 
315
  # Fetch NASA ADS references using the full prompt
316
+ references = fetch_nasa_ads_references(subdomain)
317
 
318
  # Generate response from GPT-4
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, subdomain, user_input)
323
 
324
  # Fetch exoplanet data
325
  exoplanet_data = fetch_exoplanet_data()
 
371
  iface = gr.Interface(
372
  fn=chatbot,
373
  inputs=[
 
374
  gr.Textbox(lines=5, placeholder="Enter your Science Goal...", label="Science Goal"),
375
+ gr.Textbox(lines=10, placeholder="Enter Context Text...", label="Context"),
376
+ gr.Textbox(lines=2, placeholder="Define your Subdomain...", label="Subdomain Definition"),
377
  gr.Checkbox(label="Use NASA SMD Bi-Encoder for Context"),
378
  gr.Slider(50, 2000, value=150, step=10, label="Max Tokens"),
379
  gr.Slider(0.0, 1.0, value=0.7, step=0.1, label="Temperature"),