minko186 commited on
Commit
e0ce3d4
·
verified ·
1 Parent(s): d994b45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -10,6 +10,7 @@ def on_first_button_click():
10
  def ai_article_generator(
11
  text
12
  ):
 
13
  ai_text = generate(f"Write an article about the topic: {text}")
14
  ai_text = ai_text.choices[0].message.content
15
  return ai_text
@@ -67,6 +68,14 @@ with gr.Blocks() as demo:
67
  with gr.Column(scale=0.7):
68
  gr.Markdown("## Enter a topic to write an article about:")
69
  input_topic = gr.Textbox(label="Topic")
 
 
 
 
 
 
 
 
70
  ai_article_btn = gr.Button("Generate", visible=True)
71
  ai_generated = gr.Markdown("### Generated article:", visible=False)
72
  ai_label = gr.HTML(label="AI", visible=False)
@@ -128,7 +137,7 @@ with gr.Blocks() as demo:
128
  ai_article_btn.click(
129
  fn=ai_article_generator,
130
  inputs=[
131
- input_topic
132
  ],
133
  outputs=[ai_label],
134
  )
 
10
  def ai_article_generator(
11
  text
12
  ):
13
+ prompt = f"Write a {text[1]} about the topic in about {text[2]} words: {text[0]}"
14
  ai_text = generate(f"Write an article about the topic: {text}")
15
  ai_text = ai_text.choices[0].message.content
16
  return ai_text
 
68
  with gr.Column(scale=0.7):
69
  gr.Markdown("## Enter a topic to write an article about:")
70
  input_topic = gr.Textbox(label="Topic")
71
+ with gr.Row():
72
+ gr.Markdown("## Choose type of text:")
73
+ input_type = gr.Dropdown(
74
+ choices = ['article', 'essay', 'blog', 'report', 'letter'],
75
+ value = 'article'
76
+ )
77
+ gr.Markdown("## Enter length of the text:")
78
+ input_length = gr.Number(value=200)
79
  ai_article_btn = gr.Button("Generate", visible=True)
80
  ai_generated = gr.Markdown("### Generated article:", visible=False)
81
  ai_label = gr.HTML(label="AI", visible=False)
 
137
  ai_article_btn.click(
138
  fn=ai_article_generator,
139
  inputs=[
140
+ (input_topic, input_type, input_length)
141
  ],
142
  outputs=[ai_label],
143
  )