Spaces:
Sleeping
Sleeping
Lautaro Cardarelli
commited on
Commit
·
ba197d5
1
Parent(s):
3ef0d51
add chatbot interface
Browse files
app.py
CHANGED
@@ -144,7 +144,10 @@ class SummarizerAndQA:
|
|
144 |
return generate_summary(text)
|
145 |
|
146 |
def process_questions(self):
|
147 |
-
return
|
|
|
|
|
|
|
148 |
|
149 |
summarizer_and_qa = SummarizerAndQA()
|
150 |
|
@@ -163,4 +166,5 @@ questions_response = gr.Textbox(label="Respuestas", lines=5)
|
|
163 |
# --------------
|
164 |
summarizer_interface = gr.Interface(fn=summarizer_and_qa.process_summarizer, inputs=[textbox_input], outputs=[summary_output], allow_flagging="never")
|
165 |
questions_interface = gr.Interface(fn=summarizer_and_qa.process_questions, inputs=[], outputs=[questions_output], allow_flagging="never")
|
166 |
-
gr.
|
|
|
|
144 |
return generate_summary(text)
|
145 |
|
146 |
def process_questions(self):
|
147 |
+
return generate_questions(self.input_text)
|
148 |
+
|
149 |
+
def process_question_response(self, question):
|
150 |
+
return generate_question_response(question, self.input_text)
|
151 |
|
152 |
summarizer_and_qa = SummarizerAndQA()
|
153 |
|
|
|
166 |
# --------------
|
167 |
summarizer_interface = gr.Interface(fn=summarizer_and_qa.process_summarizer, inputs=[textbox_input], outputs=[summary_output], allow_flagging="never")
|
168 |
questions_interface = gr.Interface(fn=summarizer_and_qa.process_questions, inputs=[], outputs=[questions_output], allow_flagging="never")
|
169 |
+
chatbot_interface = gr.ChatInterface(fn=summarizer_and_qa.process_question_response, type="messages", examples=["hello", "hola", "merhaba"], title="Preguntas sobre el texto")
|
170 |
+
gr.TabbedInterface([summarizer_interface, questions_interface, chatbot_interface], ["Resumidor", "Preguntas de guia", "Chatbot"]).launch()
|