Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -493,100 +493,177 @@ elif Usage == 'Random Questions':
|
|
493 |
('TEXT', 'SPEECH')
|
494 |
)
|
495 |
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
response = openai.Completion.create(
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
frequency_penalty=0,
|
516 |
-
presence_penalty=0
|
517 |
)
|
518 |
string_temp=response.choices[0].text
|
519 |
-
|
520 |
if ("gen_draw" in string_temp):
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
# What this means is that as long as all generation parameters remain the same, you can always recall the same image simply by generating it again.
|
540 |
-
# Note: This isn't quite the case for Clip Guided generations, which we'll tackle in a future example notebook.
|
541 |
-
steps=30, # Amount of inference steps performed on image generation. Defaults to 30.
|
542 |
-
cfg_scale=8.0, # Influences how strongly your generation is guided to match your prompt.
|
543 |
-
# Setting this value higher increases the strength in which it tries to match your prompt.
|
544 |
-
# Defaults to 7.0 if not specified.
|
545 |
-
width=512, # Generation width, defaults to 512 if not included.
|
546 |
-
height=512, # Generation height, defaults to 512 if not included.
|
547 |
-
samples=1, # Number of images to generate, defaults to 1 if not included.
|
548 |
-
sampler=generation.SAMPLER_K_DPMPP_2M # Choose which sampler we want to denoise our generation with.
|
549 |
-
# Defaults to k_dpmpp_2m if not specified. Clip Guidance only supports ancestral samplers.
|
550 |
-
# (Available Samplers: ddim, plms, k_euler, k_euler_ancestral, k_heun, k_dpm_2, k_dpm_2_ancestral, k_dpmpp_2s_ancestral, k_lms, k_dpmpp_2m)
|
551 |
-
)
|
552 |
-
|
553 |
-
# Set up our warning to print to the console if the adult content classifier is tripped.
|
554 |
-
# If adult content classifier is not tripped, save generated images.
|
555 |
-
for resp in answers:
|
556 |
-
for artifact in resp.artifacts:
|
557 |
-
if artifact.finish_reason == generation.FILTER:
|
558 |
-
warnings.warn(
|
559 |
-
"Your request activated the API's safety filters and could not be processed."
|
560 |
-
"Please modify the prompt and try again.")
|
561 |
-
if artifact.type == generation.ARTIFACT_IMAGE:
|
562 |
-
img = Image.open(io.BytesIO(artifact.binary))
|
563 |
-
st.image(img)
|
564 |
-
img.save(str(artifact.seed)+ ".png") # Save our generated images with their seed number as the filename.
|
565 |
-
rx = 'Image returned'
|
566 |
-
g_sheet_log(mytext, rx)
|
567 |
-
|
568 |
-
# except:
|
569 |
-
# st.write('image is being generated please wait...')
|
570 |
-
# def extract_image_description(input_string):
|
571 |
-
# return input_string.split('gen_draw("')[1].split('")')[0]
|
572 |
-
# prompt=extract_image_description(string_temp)
|
573 |
-
# # model_id = "CompVis/stable-diffusion-v1-4"
|
574 |
-
# model_id='runwayml/stable-diffusion-v1-5'
|
575 |
-
# device = "cuda"
|
576 |
-
|
577 |
-
|
578 |
-
# pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
579 |
-
# pipe = pipe.to(device)
|
580 |
-
|
581 |
-
# # prompt = "a photo of an astronaut riding a horse on mars"
|
582 |
-
# image = pipe(prompt).images[0]
|
583 |
-
|
584 |
-
# image.save("astronaut_rides_horse.png")
|
585 |
-
# st.image(image)
|
586 |
-
# # image
|
587 |
-
|
588 |
elif ("vid_tube" in string_temp):
|
589 |
-
s = Search(
|
590 |
search_res = s.results
|
591 |
first_vid = search_res[0]
|
592 |
print(first_vid)
|
@@ -597,35 +674,45 @@ elif Usage == 'Random Questions':
|
|
597 |
OurURL = YoutubeURL + video_id
|
598 |
st.write(OurURL)
|
599 |
st_player(OurURL)
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
elif ("don't" in string_temp or "internet" in string_temp):
|
604 |
-
st.write('searching internet ')
|
605 |
search_internet(question)
|
606 |
-
rz = 'Internet result returned'
|
607 |
-
g_sheet_log(mytext, string_temp)
|
608 |
-
|
609 |
else:
|
610 |
st.write(string_temp)
|
611 |
-
g_sheet_log(mytext, string_temp)
|
612 |
-
|
613 |
-
elif Input_type == 'SPEECH':
|
614 |
-
try:
|
615 |
-
st.text("Record your audio, **max length - 5 seconds**")
|
616 |
-
if st.button("Record"):
|
617 |
-
st.write("Recording...")
|
618 |
-
audio_file = record_audio()
|
619 |
-
st.write("Recording complete.")
|
620 |
-
file = open(audio_file, "rb")
|
621 |
-
|
622 |
-
# Play the recorded audio
|
623 |
-
st.audio(audio_file)
|
624 |
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
response = openai.Completion.create(
|
630 |
model="text-davinci-003",
|
631 |
prompt=f'''Your knowledge cutoff is 2021-09, and it is not aware of any events after that time. if the
|
@@ -680,92 +767,5 @@ elif Usage == 'Random Questions':
|
|
680 |
search_internet(question)
|
681 |
else:
|
682 |
st.write(string_temp)
|
683 |
-
|
684 |
-
except:
|
685 |
-
stt_button = Button(label="Speak", width=100)
|
686 |
-
stt_button.js_on_event("button_click", CustomJS(code="""
|
687 |
-
var recognition = new webkitSpeechRecognition();
|
688 |
-
recognition.continuous = true;
|
689 |
-
recognition.interimResults = true;
|
690 |
-
recognition.onresult = function (e) {
|
691 |
-
var value = "";
|
692 |
-
for (var i = e.resultIndex; i < e.results.length; ++i) {
|
693 |
-
if (e.results[i].isFinal) {
|
694 |
-
value += e.results[i][0].transcript;
|
695 |
-
}
|
696 |
-
}
|
697 |
-
if ( value != "") {
|
698 |
-
document.dispatchEvent(new CustomEvent("GET_TEXT", {detail: value}));
|
699 |
-
}
|
700 |
-
}
|
701 |
-
recognition.start();
|
702 |
-
"""))
|
703 |
-
|
704 |
-
result = streamlit_bokeh_events(
|
705 |
-
stt_button,
|
706 |
-
events="GET_TEXT",
|
707 |
-
key="listen",
|
708 |
-
refresh_on_update=False,
|
709 |
-
override_height=75,
|
710 |
-
debounce_time=0)
|
711 |
-
|
712 |
-
if result:
|
713 |
-
if "GET_TEXT" in result:
|
714 |
-
st.write(result.get("GET_TEXT"))
|
715 |
-
question = result.get("GET_TEXT")
|
716 |
-
response = openai.Completion.create(
|
717 |
-
model="text-davinci-003",
|
718 |
-
prompt=f'''Your knowledge cutoff is 2021-09, and it is not aware of any events after that time. if the
|
719 |
-
Answer to following questions is not from your knowledge base or in case of queries like weather
|
720 |
-
updates / stock updates / current news Etc which requires you to have internet connection then print i don't have access to internet to answer your question,
|
721 |
-
if question is related to image or painting or drawing generation then print ipython type output function gen_draw("detailed prompt of image to be generated")
|
722 |
-
if the question is related to playing a song or video or music of a singer then print ipython type output function vid_tube("relevent search query")
|
723 |
-
\nQuestion-{question}
|
724 |
-
\nAnswer -''',
|
725 |
-
temperature=0.49,
|
726 |
-
max_tokens=256,
|
727 |
-
top_p=1,
|
728 |
-
frequency_penalty=0,
|
729 |
-
presence_penalty=0
|
730 |
-
)
|
731 |
-
string_temp=response.choices[0].text
|
732 |
-
|
733 |
-
if ("gen_draw" in string_temp):
|
734 |
-
st.write('*image is being generated please wait..* ')
|
735 |
-
def extract_image_description(input_string):
|
736 |
-
return input_string.split('gen_draw("')[1].split('")')[0]
|
737 |
-
prompt=extract_image_description(string_temp)
|
738 |
-
# model_id = "CompVis/stable-diffusion-v1-4"
|
739 |
-
model_id='runwayml/stable-diffusion-v1-5'
|
740 |
-
device = "cuda"
|
741 |
-
|
742 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
743 |
-
pipe = pipe.to(device)
|
744 |
-
|
745 |
-
# prompt = "a photo of an astronaut riding a horse on mars"
|
746 |
-
image = pipe(prompt).images[0]
|
747 |
-
|
748 |
-
image.save("astronaut_rides_horse.png")
|
749 |
-
st.image(image)
|
750 |
-
# image
|
751 |
-
|
752 |
-
elif ("vid_tube" in string_temp):
|
753 |
-
s = Search(question)
|
754 |
-
search_res = s.results
|
755 |
-
first_vid = search_res[0]
|
756 |
-
print(first_vid)
|
757 |
-
string = str(first_vid)
|
758 |
-
video_id = string[string.index('=') + 1:-1]
|
759 |
-
# print(video_id)
|
760 |
-
YoutubeURL = "https://www.youtube.com/watch?v="
|
761 |
-
OurURL = YoutubeURL + video_id
|
762 |
-
st.write(OurURL)
|
763 |
-
st_player(OurURL)
|
764 |
-
|
765 |
-
elif ("don't" in string_temp or "internet" in string_temp ):
|
766 |
-
st.write('*searching internet*')
|
767 |
-
search_internet(question)
|
768 |
-
else:
|
769 |
-
st.write(string_temp)
|
770 |
else:
|
771 |
pass
|
|
|
493 |
('TEXT', 'SPEECH')
|
494 |
)
|
495 |
|
496 |
+
if Input_type == 'TEXT':
|
497 |
+
st.write('**You are now in Text input mode**')
|
498 |
+
mytext = st.text_input('**Go on! Ask me anything:**')
|
499 |
+
if st.button("SUBMIT"):
|
500 |
+
question=mytext
|
501 |
+
response = openai.Completion.create(
|
502 |
+
model="text-davinci-003",
|
503 |
+
prompt=f'''Your name is HyperBot and knowledge cutoff date is 2021-09, and you are not aware of any events after that time. if the
|
504 |
+
Answer to following questions is not from your knowledge base or in case of queries like weather
|
505 |
+
updates / stock updates / current news or people which requires you to have internet connection then print i don't have access to internet to answer your question,
|
506 |
+
if question is related to image or painting or drawing generation then print ipython type output function gen_draw("detailed prompt of image to be generated")
|
507 |
+
if the question is related to playing a song or video or music of a singer then print ipython type output function vid_tube("relevent search query")
|
508 |
+
if the question is related to operating home appliances then print ipython type output function home_app(" action(ON/Off),appliance(TV,Geaser,Fridge,Lights,fans,AC)") .
|
509 |
+
if question is realted to sending mail or sms then print ipython type output function messenger_app(" message of us ,messenger(email,sms)")
|
510 |
+
\nQuestion-{question}
|
511 |
+
\nAnswer -''',
|
512 |
+
temperature=0.49,
|
513 |
+
max_tokens=256,
|
514 |
+
top_p=1,
|
515 |
+
frequency_penalty=0,
|
516 |
+
presence_penalty=0
|
517 |
+
)
|
518 |
+
string_temp=response.choices[0].text
|
519 |
+
|
520 |
+
if ("gen_draw" in string_temp):
|
521 |
+
try:
|
522 |
+
try:
|
523 |
+
wget.download(openai_response(prompt))
|
524 |
+
img2 = Image.open(wget.download(openai_response(prompt)))
|
525 |
+
img2.show()
|
526 |
+
rx = 'Image returned'
|
527 |
+
g_sheet_log(mytext, rx)
|
528 |
+
except:
|
529 |
+
urllib.request.urlretrieve(openai_response(prompt),"img_ret.png")
|
530 |
+
img = Image.open("img_ret.png")
|
531 |
+
img.show()
|
532 |
+
rx = 'Image returned'
|
533 |
+
g_sheet_log(mytext, rx)
|
534 |
+
except:
|
535 |
+
# Set up our initial generation parameters.
|
536 |
+
answers = stability_api.generate(
|
537 |
+
prompt = mytext,
|
538 |
+
seed=992446758, # If a seed is provided, the resulting generated image will be deterministic.
|
539 |
+
# What this means is that as long as all generation parameters remain the same, you can always recall the same image simply by generating it again.
|
540 |
+
# Note: This isn't quite the case for Clip Guided generations, which we'll tackle in a future example notebook.
|
541 |
+
steps=30, # Amount of inference steps performed on image generation. Defaults to 30.
|
542 |
+
cfg_scale=8.0, # Influences how strongly your generation is guided to match your prompt.
|
543 |
+
# Setting this value higher increases the strength in which it tries to match your prompt.
|
544 |
+
# Defaults to 7.0 if not specified.
|
545 |
+
width=512, # Generation width, defaults to 512 if not included.
|
546 |
+
height=512, # Generation height, defaults to 512 if not included.
|
547 |
+
samples=1, # Number of images to generate, defaults to 1 if not included.
|
548 |
+
sampler=generation.SAMPLER_K_DPMPP_2M # Choose which sampler we want to denoise our generation with.
|
549 |
+
# Defaults to k_dpmpp_2m if not specified. Clip Guidance only supports ancestral samplers.
|
550 |
+
# (Available Samplers: ddim, plms, k_euler, k_euler_ancestral, k_heun, k_dpm_2, k_dpm_2_ancestral, k_dpmpp_2s_ancestral, k_lms, k_dpmpp_2m)
|
551 |
+
)
|
552 |
+
|
553 |
+
# Set up our warning to print to the console if the adult content classifier is tripped.
|
554 |
+
# If adult content classifier is not tripped, save generated images.
|
555 |
+
for resp in answers:
|
556 |
+
for artifact in resp.artifacts:
|
557 |
+
if artifact.finish_reason == generation.FILTER:
|
558 |
+
warnings.warn(
|
559 |
+
"Your request activated the API's safety filters and could not be processed."
|
560 |
+
"Please modify the prompt and try again.")
|
561 |
+
if artifact.type == generation.ARTIFACT_IMAGE:
|
562 |
+
img = Image.open(io.BytesIO(artifact.binary))
|
563 |
+
st.image(img)
|
564 |
+
img.save(str(artifact.seed)+ ".png") # Save our generated images with their seed number as the filename.
|
565 |
+
rx = 'Image returned'
|
566 |
+
g_sheet_log(mytext, rx)
|
567 |
+
|
568 |
+
# except:
|
569 |
+
# st.write('image is being generated please wait...')
|
570 |
+
# def extract_image_description(input_string):
|
571 |
+
# return input_string.split('gen_draw("')[1].split('")')[0]
|
572 |
+
# prompt=extract_image_description(string_temp)
|
573 |
+
# # model_id = "CompVis/stable-diffusion-v1-4"
|
574 |
+
# model_id='runwayml/stable-diffusion-v1-5'
|
575 |
+
# device = "cuda"
|
576 |
+
|
577 |
+
|
578 |
+
# pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
579 |
+
# pipe = pipe.to(device)
|
580 |
+
|
581 |
+
# # prompt = "a photo of an astronaut riding a horse on mars"
|
582 |
+
# image = pipe(prompt).images[0]
|
583 |
+
|
584 |
+
# image.save("astronaut_rides_horse.png")
|
585 |
+
# st.image(image)
|
586 |
+
# # image
|
587 |
+
|
588 |
+
elif ("vid_tube" in string_temp):
|
589 |
+
s = Search(mytext)
|
590 |
+
search_res = s.results
|
591 |
+
first_vid = search_res[0]
|
592 |
+
print(first_vid)
|
593 |
+
string = str(first_vid)
|
594 |
+
video_id = string[string.index('=') + 1:-1]
|
595 |
+
# print(video_id)
|
596 |
+
YoutubeURL = "https://www.youtube.com/watch?v="
|
597 |
+
OurURL = YoutubeURL + video_id
|
598 |
+
st.write(OurURL)
|
599 |
+
st_player(OurURL)
|
600 |
+
ry = 'Youtube link and video returned'
|
601 |
+
g_sheet_log(mytext, ry)
|
602 |
+
|
603 |
+
elif ("don't" in string_temp or "internet" in string_temp):
|
604 |
+
st.write('searching internet ')
|
605 |
+
search_internet(question)
|
606 |
+
rz = 'Internet result returned'
|
607 |
+
g_sheet_log(mytext, string_temp)
|
608 |
+
|
609 |
+
else:
|
610 |
+
st.write(string_temp)
|
611 |
+
g_sheet_log(mytext, string_temp)
|
612 |
+
|
613 |
+
elif Input_type == 'SPEECH':
|
614 |
+
try:
|
615 |
+
st.text("Record your audio, **max length - 5 seconds**")
|
616 |
+
if st.button("Record"):
|
617 |
+
st.write("Recording...")
|
618 |
+
audio_file = record_audio()
|
619 |
+
st.write("Recording complete.")
|
620 |
+
file = open(audio_file, "rb")
|
621 |
+
|
622 |
+
# Play the recorded audio
|
623 |
+
st.audio(audio_file)
|
624 |
+
|
625 |
+
transcription = openai.Audio.transcribe("whisper-1", file)
|
626 |
+
result = transcription["text"]
|
627 |
+
st.write(f"Fetched from audio - {result}")
|
628 |
+
question = result
|
629 |
response = openai.Completion.create(
|
630 |
+
model="text-davinci-003",
|
631 |
+
prompt=f'''Your knowledge cutoff is 2021-09, and it is not aware of any events after that time. if the
|
632 |
+
Answer to following questions is not from your knowledge base or in case of queries like weather
|
633 |
+
updates / stock updates / current news Etc which requires you to have internet connection then print i don't have access to internet to answer your question,
|
634 |
+
if question is related to image or painting or drawing generation then print ipython type output function gen_draw("detailed prompt of image to be generated")
|
635 |
+
if the question is related to playing a song or video or music of a singer then print ipython type output function vid_tube("relevent search query")
|
636 |
+
\nQuestion-{question}
|
637 |
+
\nAnswer -''',
|
638 |
+
temperature=0.49,
|
639 |
+
max_tokens=256,
|
640 |
+
top_p=1,
|
641 |
+
frequency_penalty=0,
|
642 |
+
presence_penalty=0
|
|
|
|
|
643 |
)
|
644 |
string_temp=response.choices[0].text
|
645 |
+
|
646 |
if ("gen_draw" in string_temp):
|
647 |
+
st.write('*image is being generated please wait..* ')
|
648 |
+
def extract_image_description(input_string):
|
649 |
+
return input_string.split('gen_draw("')[1].split('")')[0]
|
650 |
+
prompt=extract_image_description(string_temp)
|
651 |
+
# model_id = "CompVis/stable-diffusion-v1-4"
|
652 |
+
model_id='runwayml/stable-diffusion-v1-5'
|
653 |
+
device = "cuda"
|
654 |
+
|
655 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
656 |
+
pipe = pipe.to(device)
|
657 |
+
|
658 |
+
# prompt = "a photo of an astronaut riding a horse on mars"
|
659 |
+
image = pipe(prompt).images[0]
|
660 |
+
|
661 |
+
image.save("astronaut_rides_horse.png")
|
662 |
+
st.image(image)
|
663 |
+
# image
|
664 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
elif ("vid_tube" in string_temp):
|
666 |
+
s = Search(question)
|
667 |
search_res = s.results
|
668 |
first_vid = search_res[0]
|
669 |
print(first_vid)
|
|
|
674 |
OurURL = YoutubeURL + video_id
|
675 |
st.write(OurURL)
|
676 |
st_player(OurURL)
|
677 |
+
|
678 |
+
elif ("don't" in string_temp or "internet" in string_temp ):
|
679 |
+
st.write('*searching internet*')
|
|
|
|
|
680 |
search_internet(question)
|
|
|
|
|
|
|
681 |
else:
|
682 |
st.write(string_temp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
|
684 |
+
except:
|
685 |
+
stt_button = Button(label="Speak", width=100)
|
686 |
+
stt_button.js_on_event("button_click", CustomJS(code="""
|
687 |
+
var recognition = new webkitSpeechRecognition();
|
688 |
+
recognition.continuous = true;
|
689 |
+
recognition.interimResults = true;
|
690 |
+
recognition.onresult = function (e) {
|
691 |
+
var value = "";
|
692 |
+
for (var i = e.resultIndex; i < e.results.length; ++i) {
|
693 |
+
if (e.results[i].isFinal) {
|
694 |
+
value += e.results[i][0].transcript;
|
695 |
+
}
|
696 |
+
}
|
697 |
+
if ( value != "") {
|
698 |
+
document.dispatchEvent(new CustomEvent("GET_TEXT", {detail: value}));
|
699 |
+
}
|
700 |
+
}
|
701 |
+
recognition.start();
|
702 |
+
"""))
|
703 |
+
|
704 |
+
result = streamlit_bokeh_events(
|
705 |
+
stt_button,
|
706 |
+
events="GET_TEXT",
|
707 |
+
key="listen",
|
708 |
+
refresh_on_update=False,
|
709 |
+
override_height=75,
|
710 |
+
debounce_time=0)
|
711 |
+
|
712 |
+
if result:
|
713 |
+
if "GET_TEXT" in result:
|
714 |
+
st.write(result.get("GET_TEXT"))
|
715 |
+
question = result.get("GET_TEXT")
|
716 |
response = openai.Completion.create(
|
717 |
model="text-davinci-003",
|
718 |
prompt=f'''Your knowledge cutoff is 2021-09, and it is not aware of any events after that time. if the
|
|
|
767 |
search_internet(question)
|
768 |
else:
|
769 |
st.write(string_temp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
else:
|
771 |
pass
|