Spaces:
Sleeping
Sleeping
File size: 10,612 Bytes
13c8e0f 6eed986 13c8e0f f757ba6 13c8e0f f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 2bc433a f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 f757ba6 6eed986 2bc433a 85e8973 2bc433a dc884c4 85e8973 2bc433a 85e8973 dc884c4 84a4a34 dc884c4 2bc433a dc884c4 2bc433a 6eed986 f757ba6 6eed986 f757ba6 6eed986 |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
import gradio as gr
from llm_call import GeminiLLM
from seminar_edition_ai import upload_file_ex, predictContemplando, predictProclamando, predictFromInit, \
downloadSermonFile, fileAddresToDownload, predictQuestionBuild, predictDevotionBuild, \
contemplandoQuestion, proclamandoQuestion, llm, embed_model
HISTORY_ANSWER = ''
with gr.Blocks() as demo:
gr.Markdown("SermonLab AI Demo.")
with gr.Tab("Preparando mi Serm贸n"):
text_input = gr.Textbox(label="T贸pico del serm贸n")
with gr.Accordion("Contemplando y Proclamando", open=False):
checkButton = gr.Checkbox(
value=False,
label="Mantener historial"
)
with gr.Row():
with gr.Tab("Contemplando"):
inbtwContemplando = gr.Button(f"Devocionalmente: {contemplandoQuestion['DEVOCIONALMENTE']}")
inbtwContemplandoOne = gr.Button(f"Ex茅gesis: {contemplandoQuestion['EX脡GESIS']}")
inbtwContemplandoTwo = gr.Button(f"Cristo: {contemplandoQuestion['CRISTO']}")
inbtwContemplandoTree = gr.Button(f"Arco Redentor: {contemplandoQuestion['ARCO REDENTOR']}")
inbtwContemplandoFour = gr.Button(f"Evangeli贸n: {contemplandoQuestion['EVANGELION']}")
inbtwContemplandoFourOne = gr.Button(f"Evangeli贸n: {contemplandoQuestion['EVANGELION_TWO']}")
with gr.Tab("Proclamando"):
inbtwProclamando = gr.Button(f"P煤blico: {proclamandoQuestion['P脷BLICO']}")
inbtwProclamandoOne = gr.Button(f"Historia: {proclamandoQuestion['HISTORIA']}")
inbtwProclamandoTwo = gr.Button(f"Expectativas: {proclamandoQuestion['EXPECTATIVAS']}")
inbtwProclamandoTwoTwo = gr.Button(f"Expectativas: {proclamandoQuestion['EXPECTATIVAS_TWO']}")
text_output = gr.Textbox(label="Respuesta", lines=10)
text_button = gr.Button("Crear")
text_download = gr.DownloadButton(
label="Descargar",
value=fileAddresToDownload,
every=10
)
inbtwContemplando.click(
fn=lambda x: predictContemplando(f"DEVOCIONALMENTE"),
inputs=text_input,
outputs=text_output
)
inbtwContemplandoOne.click(
fn=lambda x: predictContemplando(f"EX脡GESIS"),
inputs=text_input,
outputs=text_output
)
inbtwContemplandoTwo.click(
fn=lambda x: predictContemplando(f"CRISTO"),
inputs=text_input,
outputs=text_output
)
inbtwContemplandoTree.click(
fn=lambda x: predictContemplando(f"ARCO REDENTOR"),
inputs=text_input,
outputs=text_output
)
inbtwContemplandoFour.click(
fn=lambda x: predictContemplando(f"EVANGELION"),
inputs=text_input,
outputs=text_output
)
inbtwContemplandoFourOne.click(
fn=lambda x: predictContemplando(f"EVANGELION_TWO"),
inputs=text_input,
outputs=text_output
)
##---------------------------------------------------------------------
inbtwProclamando.click(
fn=lambda x: predictProclamando(f"P脷BLICO"),
inputs=text_input,
outputs=text_output
)
inbtwProclamandoOne.click(
fn=lambda x: predictProclamando(f"HISTORIA"),
inputs=text_input,
outputs=text_output
)
inbtwProclamandoTwo.click(
fn=lambda x: predictProclamando(f"EXPECTATIVAS"),
inputs=text_input,
outputs=text_output
)
inbtwProclamandoTwoTwo.click(
fn=lambda x: predictProclamando(f"EXPECTATIVAS_TWO"),
inputs=text_input,
outputs=text_output
)
text_button.click(
fn=predictFromInit,
inputs=text_input,
outputs=text_output
)
text_download.click(
fn=downloadSermonFile,
inputs=text_output
)
with gr.Tab("Obtener gu铆a de la comunidad (Preguntas)"):
with gr.Accordion("Contemplando y Proclamando", open=False):
checkButton = gr.Checkbox(
value=False,
label="Mantener historial"
)
with gr.Row():
with gr.Tab("Contemplando"):
inbtwContemplando = gr.Button(f"Devocionalmente: {contemplandoQuestion['DEVOCIONALMENTE']}")
inbtwContemplandoOne = gr.Button(f"Ex茅gesis: {contemplandoQuestion['EX脡GESIS']}")
inbtwContemplandoTwo = gr.Button(f"Cristo: {contemplandoQuestion['CRISTO']}")
inbtwContemplandoTree = gr.Button(f"Arco Redentor: {contemplandoQuestion['ARCO REDENTOR']}")
inbtwContemplandoFour = gr.Button(f"Evangeli贸n: {contemplandoQuestion['EVANGELION']}")
inbtwContemplandoFourOne = gr.Button(f"Evangeli贸n: {contemplandoQuestion['EVANGELION_TWO']}")
with gr.Tab("Proclamando"):
inbtwProclamando = gr.Button(f"P煤blico: {proclamandoQuestion['P脷BLICO']}")
inbtwProclamandoOne = gr.Button(f"Historia: {proclamandoQuestion['HISTORIA']}")
inbtwProclamandoTwo = gr.Button(f"Expectativas: {proclamandoQuestion['EXPECTATIVAS']}")
inbtwProclamandoTwoTwo = gr.Button(f"Expectativas: {proclamandoQuestion['EXPECTATIVAS_TWO']}")
with gr.Row():
#Bibliografy about components
# File (https://www.gradio.app/docs/gradio/file)
# Download Button (https://www.gradio.app/docs/gradio/downloadbutton)
with gr.Column():
file_input_question = gr.File()
upload_button_question = gr.UploadButton("Click to Upload a File", file_types=['.pdf'],
file_count="multiple")
with gr.Column():
temp_slider_question = gr.Slider(
minimum=1,
maximum=10,
value=1,
step=1,
interactive=True,
label="Preguntas",
)
text_output_question = gr.Textbox(label="Respuesta", lines=10)
text_button_question = gr.Button("Crear gu铆a de preguntas")
text_download_question = gr.DownloadButton(
label="Descargar",
value=fileAddresToDownload,
every=10
)
text_button_question.click(
fn=predictQuestionBuild,
outputs=text_output_question
)
upload_button_question.upload(upload_file_ex, inputs=upload_button_question,
outputs=[file_input_question, text_output_question])
with gr.Tab("Obtener gu铆a de la comunidad (Devocionario)"):
with gr.Row():
#Bibliografy about components
# File (https://www.gradio.app/docs/gradio/file)
# Download Button (https://www.gradio.app/docs/gradio/downloadbutton)
with gr.Column():
file_input_devotions = gr.File()
upload_button_devotion = gr.UploadButton("Click to Upload a File", file_types=['.pdf'],
file_count="multiple")
with gr.Column():
temp_slider_question = gr.Slider(
minimum=1,
maximum=10,
value=1,
step=1,
interactive=True,
label="Cantidad",
)
text_output_devotions = gr.Textbox(label="Respuesta", lines=10)
text_button_devotion = gr.Button("Crear")
text_download_question = gr.DownloadButton(
label="Descargar",
value=fileAddresToDownload,
every=10
)
text_button_devotion.click(
fn=predictDevotionBuild,
outputs=text_output_devotions
)
upload_button_devotion.upload(
upload_file_ex,
inputs=upload_button_devotion,
outputs=
[file_input_devotions, text_output_devotions]
)
with gr.Tab("Contemplando y Proclamando (Gu铆a de preguntas)"):
with gr.Accordion("Contemplando y Proclamando", open=False):
checkButton = gr.Checkbox(
value=False,
label="Mantener historial"
)
with gr.Row():
with gr.Tab("Contemplando"):
inbtwContemplando = gr.Button(f"Devocionalmente: {contemplandoQuestion['DEVOCIONALMENTE']}")
inbtwContemplandoOne = gr.Button(f"Ex茅gesis: {contemplandoQuestion['EX脡GESIS']}")
inbtwContemplandoTwo = gr.Button(f"Cristo: {contemplandoQuestion['CRISTO']}")
inbtwContemplandoTree = gr.Button(f"Arco Redentor: {contemplandoQuestion['ARCO REDENTOR']}")
inbtwContemplandoFour = gr.Button(f"Evangeli贸n: {contemplandoQuestion['EVANGELION']}")
inbtwContemplandoFourOne = gr.Button(f"Evangeli贸n: {contemplandoQuestion['EVANGELION_TWO']}")
with gr.Tab("Proclamando"):
inbtwProclamando = gr.Button(f"P煤blico: {proclamandoQuestion['P脷BLICO']}")
inbtwProclamandoOne = gr.Button(f"Historia: {proclamandoQuestion['HISTORIA']}")
inbtwProclamandoTwo = gr.Button(f"Expectativas: {proclamandoQuestion['EXPECTATIVAS']}")
inbtwProclamandoTwoTwo = gr.Button(f"Expectativas: {proclamandoQuestion['EXPECTATIVAS_TWO']}")
with gr.Row():
with gr.Column():
#Answer for Contemplando y Proclamando questions
text_output_guia = gr.Textbox(label="Respuesta", lines=10)
with gr.Column(scale = 1):
text1 = gr.Textbox(visible = False)
#Button for calling AI Help
text_button = gr.Button("Buscar m谩s informaci贸n (IA)")
text2 = gr.Textbox(visible = False)
with gr.Column():
text_output_aiAnswer= gr.Textbox(label="Ayuda a mi respuesta", lines=10)
if __name__ == "__main__":
llmBuilder = GeminiLLM()
embed_model = llmBuilder.getEmbeddingsModel()
llm = llmBuilder.getLLM()
demo.launch()
|