Update app.py
Browse files
app.py
CHANGED
@@ -156,7 +156,7 @@ def answer_question(context, question):
|
|
156 |
messages = [
|
157 |
# {"role": "system", "content": "You are a helpful assistant who can answer questions based on the given context."},
|
158 |
{"role":"system", "content": SYSTEM_MESSAGE},
|
159 |
-
{"role": "user", "content": f"Context: {context}\n
|
160 |
]
|
161 |
|
162 |
response = qa_pipeline(messages, max_new_tokens=256)[0]['generated_text']
|
@@ -182,10 +182,10 @@ with gr.Blocks() as iface:
|
|
182 |
translation_output = gr.Textbox(label="Transcription/Translation", lines=10)
|
183 |
|
184 |
with gr.Row():
|
185 |
-
with gr.Column():
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
with gr.Column():
|
190 |
question_input = gr.Textbox(label="Ask a question about the transcription")
|
191 |
answer_button = gr.Button("Get Answer")
|
@@ -199,12 +199,12 @@ with gr.Blocks() as iface:
|
|
199 |
# outputs=[ASR_RESULT]
|
200 |
)
|
201 |
# translated_text = ''.join(item['translated'] for item in ASR_RESULT if 'translated' in item)
|
202 |
-
summarize_button.click(
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
)
|
208 |
|
209 |
answer_button.click(
|
210 |
answer_question,
|
|
|
156 |
messages = [
|
157 |
# {"role": "system", "content": "You are a helpful assistant who can answer questions based on the given context."},
|
158 |
{"role":"system", "content": SYSTEM_MESSAGE},
|
159 |
+
{"role": "user", "content": f"Context: {context}\n Question: {question}"}
|
160 |
]
|
161 |
|
162 |
response = qa_pipeline(messages, max_new_tokens=256)[0]['generated_text']
|
|
|
182 |
translation_output = gr.Textbox(label="Transcription/Translation", lines=10)
|
183 |
|
184 |
with gr.Row():
|
185 |
+
# with gr.Column():
|
186 |
+
# summarize_button = gr.Button("Summarize")
|
187 |
+
# summary_output = gr.Textbox(label="Summary", lines=3)
|
188 |
+
|
189 |
with gr.Column():
|
190 |
question_input = gr.Textbox(label="Ask a question about the transcription")
|
191 |
answer_button = gr.Button("Get Answer")
|
|
|
199 |
# outputs=[ASR_RESULT]
|
200 |
)
|
201 |
# translated_text = ''.join(item['translated'] for item in ASR_RESULT if 'translated' in item)
|
202 |
+
# summarize_button.click(
|
203 |
+
# summarize_text,
|
204 |
+
# # inputs=[ASR_RESULT],
|
205 |
+
# inputs=[translation_output],
|
206 |
+
# outputs=[summary_output]
|
207 |
+
# )
|
208 |
|
209 |
answer_button.click(
|
210 |
answer_question,
|