Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,11 @@ def on_first_button_click():
|
|
8 |
return gr.update(visible=True)
|
9 |
|
10 |
def ai_article_generator(
|
11 |
-
topic,
|
12 |
):
|
13 |
-
prompt = f"Write a {
|
14 |
print(prompt)
|
15 |
-
ai_text = generate(f"Write an article about the topic: {text}")
|
16 |
ai_text = ai_text.choices[0].message.content
|
17 |
return ai_text
|
18 |
|
@@ -77,10 +77,10 @@ with gr.Blocks() as demo:
|
|
77 |
input_topic = gr.Textbox(label="Topic")
|
78 |
with gr.Row():
|
79 |
with gr.Column():
|
80 |
-
|
81 |
choices = ['article', 'essay', 'blog', 'report', 'letter'],
|
82 |
value = 'article',
|
83 |
-
label="Choose
|
84 |
)
|
85 |
with gr.Column():
|
86 |
input_length = gr.Number(value=200, label="Choose length of the text:")
|
@@ -154,8 +154,9 @@ with gr.Blocks() as demo:
|
|
154 |
fn=ai_article_generator,
|
155 |
inputs=[
|
156 |
input_topic,
|
157 |
-
|
158 |
-
input_length
|
|
|
159 |
],
|
160 |
outputs=[ai_label],
|
161 |
)
|
|
|
8 |
return gr.update(visible=True)
|
9 |
|
10 |
def ai_article_generator(
|
11 |
+
topic, text_type, length, ai_model
|
12 |
):
|
13 |
+
prompt = f"Write a {text_type} about the topic in about {length} words: {topic}"
|
14 |
print(prompt)
|
15 |
+
ai_text = generate(f"Write an article about the topic: {text}", ai_model)
|
16 |
ai_text = ai_text.choices[0].message.content
|
17 |
return ai_text
|
18 |
|
|
|
77 |
input_topic = gr.Textbox(label="Topic")
|
78 |
with gr.Row():
|
79 |
with gr.Column():
|
80 |
+
input_text_type = gr.Dropdown(
|
81 |
choices = ['article', 'essay', 'blog', 'report', 'letter'],
|
82 |
value = 'article',
|
83 |
+
label="Choose text_type of text:"
|
84 |
)
|
85 |
with gr.Column():
|
86 |
input_length = gr.Number(value=200, label="Choose length of the text:")
|
|
|
154 |
fn=ai_article_generator,
|
155 |
inputs=[
|
156 |
input_topic,
|
157 |
+
input_text_type,
|
158 |
+
input_length,
|
159 |
+
ai_generator
|
160 |
],
|
161 |
outputs=[ai_label],
|
162 |
)
|