CobaltZvc commited on
Commit
f929db8
1 Parent(s): 2974087

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -76
app.py CHANGED
@@ -361,7 +361,7 @@ if Usage == 'Ask me anything (CSV file data)!📊':
361
 
362
  with st.form(key='columns_in_form'):
363
  col1, col2 = st.columns(2)
364
- with col3:
365
  userPrompt = st.text_area("Input Prompt",'Enter Natural Language Query')
366
  submitButton = st.form_submit_button(label = 'Submit')
367
  if submitButton:
@@ -371,43 +371,43 @@ if Usage == 'Ask me anything (CSV file data)!📊':
371
  except:
372
  results = gpt3(userPrompt)
373
  st.success('loaded')
374
- with col4:
375
- sqlOutput = gpt3(col_p) #st.text_area('SQL Query', value=gpt3(col_p))
376
- warning(sqlOutput)
377
- # cars=pd.read_csv('cars.csv')
378
- result_tab2=ps.sqldf(sqlOutput)
379
- st.write(result_tab2)
380
- with open("fewshot_matplot.txt", "r") as file:
381
- text_plot = file.read()
382
-
383
- result_tab = result_tab2.reset_index(drop=True)
384
- result_tab_string = result_tab.to_string()
385
- gr_prompt = text_plot + userPrompt + result_tab_string + "Plot graph for: "
386
-
387
- if len(gr_prompt) > 4097:
388
- st.write('OVERWHELMING DATA!!! You have given me more than 4097 tokens! ^_^')
389
- st.write('As of today, the NLP model text-davinci-003/gpt-3.5-turbo that I run on takes in inputs that have less than 4097 tokens. Kindly retry ^_^')
390
-
391
- elif len(result_tab2.columns) < 2:
392
- st.write("I need more data to conduct analysis and provide visualizations for you... ^_^")
393
-
394
- else:
395
- st.success("Plotting...")
396
- response_graph = openai.Completion.create(
397
- engine="text-davinci-003",
398
- prompt = gr_prompt,
399
- max_tokens=1024,
400
- n=1,
401
- stop=None,
402
- temperature=0.5,
403
- )
404
-
405
- if response_graph['choices'][0]['text'] != "":
406
- print(response_graph['choices'][0]['text'])
407
- exec(response_graph['choices'][0]['text'])
408
-
409
- else:
410
- print('Retry! Graph could not be plotted *_*')
411
 
412
  elif res == "Sample_Cars_csv":
413
  df = pd.read_csv('cars.csv')
@@ -436,44 +436,44 @@ if Usage == 'Ask me anything (CSV file data)!📊':
436
  results = gpt3(userPrompt)
437
  st.success('loaded')
438
 
439
- with col2:
440
- sqlOutput = gpt3(col_p) #st.text_area('SQL Query', value=gpt3(col_p))
441
- warning(sqlOutput)
442
- cars=pd.read_csv('cars.csv')
443
- result_tab2=ps.sqldf(sqlOutput)
444
- st.write(result_tab2)
445
-
446
- with open("fewshot_matplot.txt", "r") as file:
447
- text_plot = file.read()
448
-
449
- result_tab = result_tab2.reset_index(drop=True)
450
- result_tab_string = result_tab.to_string()
451
- gr_prompt = text_plot + userPrompt + result_tab_string + "Plot graph for: "
452
-
453
- if len(gr_prompt) > 4097:
454
- st.write('OVERWHELMING DATA!!! You have given me more than 4097 tokens! ^_^')
455
- st.write('As of today, the NLP model text-davinci-003 that I run on takes in inputs that have less than 4097 tokens. Kindly retry ^_^')
456
-
457
- elif len(result_tab2.columns) < 2:
458
- st.write("I need more data to conduct analysis and provide visualizations for you... ^_^")
459
-
460
- else:
461
- st.success("Plotting...")
462
- response_graph = openai.Completion.create(
463
- engine="text-davinci-003",
464
- prompt = gr_prompt,
465
- max_tokens=1024,
466
- n=1,
467
- stop=None,
468
- temperature=0.5,
469
- )
470
-
471
- if response_graph['choices'][0]['text'] != "":
472
- print(response_graph['choices'][0]['text'])
473
- exec(response_graph['choices'][0]['text'])
474
-
475
- else:
476
- print('Retry! Graph could not be plotted *_*')
477
 
478
  elif Usage == 'Ask me anything!😊':
479
  st.text('''You can ask me:
 
361
 
362
  with st.form(key='columns_in_form'):
363
  col1, col2 = st.columns(2)
364
+ with col1:
365
  userPrompt = st.text_area("Input Prompt",'Enter Natural Language Query')
366
  submitButton = st.form_submit_button(label = 'Submit')
367
  if submitButton:
 
371
  except:
372
  results = gpt3(userPrompt)
373
  st.success('loaded')
374
+ with col2:
375
+ sqlOutput = gpt3(col_p) #st.text_area('SQL Query', value=gpt3(col_p))
376
+ warning(sqlOutput)
377
+ # cars=pd.read_csv('cars.csv')
378
+ result_tab2=ps.sqldf(sqlOutput)
379
+ st.write(result_tab2)
380
+ with open("fewshot_matplot.txt", "r") as file:
381
+ text_plot = file.read()
382
+
383
+ result_tab = result_tab2.reset_index(drop=True)
384
+ result_tab_string = result_tab.to_string()
385
+ gr_prompt = text_plot + userPrompt + result_tab_string + "Plot graph for: "
386
+
387
+ if len(gr_prompt) > 4097:
388
+ st.write('OVERWHELMING DATA!!! You have given me more than 4097 tokens! ^_^')
389
+ st.write('As of today, the NLP model text-davinci-003/gpt-3.5-turbo that I run on takes in inputs that have less than 4097 tokens. Kindly retry ^_^')
390
+
391
+ elif len(result_tab2.columns) < 2:
392
+ st.write("I need more data to conduct analysis and provide visualizations for you... ^_^")
393
+
394
+ else:
395
+ st.success("Plotting...")
396
+ response_graph = openai.Completion.create(
397
+ engine="text-davinci-003",
398
+ prompt = gr_prompt,
399
+ max_tokens=1024,
400
+ n=1,
401
+ stop=None,
402
+ temperature=0.5,
403
+ )
404
+
405
+ if response_graph['choices'][0]['text'] != "":
406
+ print(response_graph['choices'][0]['text'])
407
+ exec(response_graph['choices'][0]['text'])
408
+
409
+ else:
410
+ print('Retry! Graph could not be plotted *_*')
411
 
412
  elif res == "Sample_Cars_csv":
413
  df = pd.read_csv('cars.csv')
 
436
  results = gpt3(userPrompt)
437
  st.success('loaded')
438
 
439
+ with col2:
440
+ sqlOutput = gpt3(col_p) #st.text_area('SQL Query', value=gpt3(col_p))
441
+ warning(sqlOutput)
442
+ cars=pd.read_csv('cars.csv')
443
+ result_tab2=ps.sqldf(sqlOutput)
444
+ st.write(result_tab2)
445
+
446
+ with open("fewshot_matplot.txt", "r") as file:
447
+ text_plot = file.read()
448
+
449
+ result_tab = result_tab2.reset_index(drop=True)
450
+ result_tab_string = result_tab.to_string()
451
+ gr_prompt = text_plot + userPrompt + result_tab_string + "Plot graph for: "
452
+
453
+ if len(gr_prompt) > 4097:
454
+ st.write('OVERWHELMING DATA!!! You have given me more than 4097 tokens! ^_^')
455
+ st.write('As of today, the NLP model text-davinci-003 that I run on takes in inputs that have less than 4097 tokens. Kindly retry ^_^')
456
+
457
+ elif len(result_tab2.columns) < 2:
458
+ st.write("I need more data to conduct analysis and provide visualizations for you... ^_^")
459
+
460
+ else:
461
+ st.success("Plotting...")
462
+ response_graph = openai.Completion.create(
463
+ engine="text-davinci-003",
464
+ prompt = gr_prompt,
465
+ max_tokens=1024,
466
+ n=1,
467
+ stop=None,
468
+ temperature=0.5,
469
+ )
470
+
471
+ if response_graph['choices'][0]['text'] != "":
472
+ print(response_graph['choices'][0]['text'])
473
+ exec(response_graph['choices'][0]['text'])
474
+
475
+ else:
476
+ print('Retry! Graph could not be plotted *_*')
477
 
478
  elif Usage == 'Ask me anything!😊':
479
  st.text('''You can ask me: