Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files
app.py
CHANGED
|
@@ -52,7 +52,7 @@ with gr.Blocks(title='BotNews') as page:
|
|
| 52 |
input3 = gr.Textbox(label="Mínimo de palavras:", lines=1, value="300", scale=1)
|
| 53 |
input4 = gr.Textbox(label="Máximo de palavras:", lines=1, value="700", scale=1)
|
| 54 |
with gr.Row():
|
| 55 |
-
button1 = gr.Button("
|
| 56 |
with gr.Row():
|
| 57 |
output1 = gr.Textbox(label="Notícia gerada por IA", lines=25)
|
| 58 |
gr.Markdown("<hr>")
|
|
@@ -61,7 +61,7 @@ with gr.Blocks(title='BotNews') as page:
|
|
| 61 |
gr.Markdown("<b>Instrução:</b> Preencha abaixo com um comando para ser executado sobre a notícia (Por exemplo: 'Resuma em tópicos' ou 'Adicione um tom sarcástico').")
|
| 62 |
gr.Markdown(" ")
|
| 63 |
with gr.Row():
|
| 64 |
-
input6 = gr.Textbox(label="
|
| 65 |
with gr.Row():
|
| 66 |
button2 = gr.Button("Gerar resposta")
|
| 67 |
with gr.Row():
|
|
|
|
| 52 |
input3 = gr.Textbox(label="Mínimo de palavras:", lines=1, value="300", scale=1)
|
| 53 |
input4 = gr.Textbox(label="Máximo de palavras:", lines=1, value="700", scale=1)
|
| 54 |
with gr.Row():
|
| 55 |
+
button1 = gr.Button("Gerar notícia")
|
| 56 |
with gr.Row():
|
| 57 |
output1 = gr.Textbox(label="Notícia gerada por IA", lines=25)
|
| 58 |
gr.Markdown("<hr>")
|
|
|
|
| 61 |
gr.Markdown("<b>Instrução:</b> Preencha abaixo com um comando para ser executado sobre a notícia (Por exemplo: 'Resuma em tópicos' ou 'Adicione um tom sarcástico').")
|
| 62 |
gr.Markdown(" ")
|
| 63 |
with gr.Row():
|
| 64 |
+
input6 = gr.Textbox(label="Ajustar a notícia com IA")
|
| 65 |
with gr.Row():
|
| 66 |
button2 = gr.Button("Gerar resposta")
|
| 67 |
with gr.Row():
|
rag.py
CHANGED
|
@@ -95,16 +95,14 @@ class Rag:
|
|
| 95 |
If the pieces of text don't enough information about the question to create the news, just say that you need more sources of information, nothing more.
|
| 96 |
The news should have a title.
|
| 97 |
The news should be written in a formal language.
|
| 98 |
-
The source written in the pieces of text should not be shown in the news.
|
| 99 |
The news should have between {min_words} and {max_words} words.
|
|
|
|
| 100 |
The total of words should no be shown in the news.
|
| 101 |
-
|
|
|
|
| 102 |
The news should be about the following context: <{context}>
|
| 103 |
Question: <{question}>
|
| 104 |
-
|
| 105 |
-
Answer here:
|
| 106 |
-
Title:
|
| 107 |
-
News:"""
|
| 108 |
self.prompt = PromptTemplate(template=prompt_template,
|
| 109 |
input_variables=["context", "question"],
|
| 110 |
partial_variables={"min_words": min_words, "max_words": max_words})
|
|
|
|
| 95 |
If the pieces of text don't enough information about the question to create the news, just say that you need more sources of information, nothing more.
|
| 96 |
The news should have a title.
|
| 97 |
The news should be written in a formal language.
|
|
|
|
| 98 |
The news should have between {min_words} and {max_words} words.
|
| 99 |
+
The source written in the pieces of text should not be shown in the news.
|
| 100 |
The total of words should no be shown in the news.
|
| 101 |
+
The news should be written in Portuguese language.
|
| 102 |
+
Answer the title and the news, once, nothing more.
|
| 103 |
The news should be about the following context: <{context}>
|
| 104 |
Question: <{question}>
|
| 105 |
+
Answer here: """
|
|
|
|
|
|
|
|
|
|
| 106 |
self.prompt = PromptTemplate(template=prompt_template,
|
| 107 |
input_variables=["context", "question"],
|
| 108 |
partial_variables={"min_words": min_words, "max_words": max_words})
|