fffiloni commited on
Commit
b4943d8
1 Parent(s): 2599239

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -14,7 +14,7 @@ def generate_story(text):
14
  prompt = PromptTemplate(
15
  input_variables=["text"],
16
  template="""
17
- You are a fun and seasoned storyteller. Generate a story for me about {text}.
18
  """
19
  )
20
  story = LLMChain(llm=llm, prompt=prompt)
@@ -24,4 +24,12 @@ def app(text):
24
  story = generate_story(text)
25
  return story
26
 
27
- gr.Interface(fn=app, inputs=[gr.Textbox()], outputs=[gr.Textbox()]).launch()
 
 
 
 
 
 
 
 
 
14
  prompt = PromptTemplate(
15
  input_variables=["text"],
16
  template="""
17
+ You are a fun and seasoned storyteller. Generate a short story for a 5 years old audience about {text}.
18
  """
19
  )
20
  story = LLMChain(llm=llm, prompt=prompt)
 
24
  story = generate_story(text)
25
  return story
26
 
27
+ with gr.Blocks() as demo:
28
+ with gr.Column():
29
+ text = gr.Textbox()
30
+ submit_btn = gr.Button('Submit')
31
+ story = gr.Textbox()
32
+
33
+ submit_btn.click(fn=app, inputs=[text], outputs=[story])
34
+
35
+ demo.launch()