File size: 740 Bytes
67e2cbc
73866b8
 
 
 
67e2cbc
73866b8
 
67e2cbc
 
 
73866b8
67e2cbc
 
73866b8
 
 
 
 
 
 
 
 
 
 
67e2cbc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import streamlit as st
import os
from generate_answer import generate_answer
from audio_to_text import audio_to_text
from text_to_audio import text_to_audio

file_path_relative = 'SDLC.wav'
file_path_abs = os.path.abspath(file_path_relative)

st.title("GPT 2 Chat Bot?")

input_text = st.text_area("Search query:")
if st.button("""Enter >>>>> """):
    if input_text:
        response_text = generate_answer(input_text)
        st.write(response_text)

st.audio(data=file_path_abs, format='audio/wav')
if st.button("""Use Audio question """):
    audio_text = audio_to_text(file_path_abs)
    answer = generate_answer(audio_text)
    audio_bytes = text_to_audio(answer)
    st.audio(audio_bytes, format="audio/wav")
    st.write(answer)