wetey commited on
Commit
0334c0d
·
1 Parent(s): c247368

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -20,6 +20,7 @@ def generate_headline(text):
20
 
21
  def generate_content(text):
22
 
 
23
  prefix = "generate_longer_text_from_headline: "
24
  input = prefix + text
25
  inputs = tokenizer(input, return_tensors="pt", max_length = 128, truncation = True).input_ids
@@ -34,14 +35,29 @@ def generate_content(text):
34
  outputs = generate_long.generate(inputs, do_sample = True, generation_config = generation_config)
35
 
36
  return tokenizer.decode(outputs[0], skip_special_tokens = True)
37
-
38
 
39
  demo = gr.Blocks()
40
 
41
  with demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  text_input = gr.Textbox(label = "Input")
43
  text_output = gr.Textbox(label = "Output")
44
-
45
  b1 = gr.Button("Generate headline")
46
  b2 = gr.Button("Generate long content")
47
 
 
20
 
21
  def generate_content(text):
22
 
23
+
24
  prefix = "generate_longer_text_from_headline: "
25
  input = prefix + text
26
  inputs = tokenizer(input, return_tensors="pt", max_length = 128, truncation = True).input_ids
 
35
  outputs = generate_long.generate(inputs, do_sample = True, generation_config = generation_config)
36
 
37
  return tokenizer.decode(outputs[0], skip_special_tokens = True)
 
38
 
39
  demo = gr.Blocks()
40
 
41
  with demo:
42
+ gr.Markdown(
43
+ '''
44
+ This app can generate a headline for a given paragraph or a paraghraph from a headline.<br>
45
+ <b>To use</b>:<br>Paste text into input text box.<br>
46
+ To generate a headline, click on "Generate headline", to generate a short paragraph, click on "Generate short Paragraph"<br>
47
+ <b>Reference</b>:<br>
48
+ Headline = "Introducing droidlet, a one-stop shop for modularly building intelligent agents"<br>
49
+ Content = "Droidlet is a platform for building intelligent agents that simplifies integrating a wide range of machine learning algorithms to facilitate rapid prototyping. It can be used to quickly test out different algorithms with a robot. Droidlet can help researchers easily build agents that can complete complex tasks in the real world or in simulated environments. This article introduces Droidlet and explains how the platform works."<br>
50
+ <b>Example - Headline generation:</b><br>
51
+ Input = "Droidlet is a platform for building intelligent agents that simplifies integrating a wide range of machine learning algorithms to facilitate rapid prototyping. It can be used to quickly test out different algorithms with a robot. Droidlet can help researchers easily build agents that can complete complex tasks in the real world or in simulated environments. This article introduces Droidlet and explains how the platform works."<br>
52
+ Output from model = "Droidlet helps researchers develop robot-like agents with automated physics"<br>
53
+ <b>Example - short paraghraph generation:</b><br>
54
+ Input = "Introducing droidlet, a one-stop shop for modularly building intelligent agents"<br>
55
+ Output from model = "The team behind the project has partnered with Google to design and build smart agents. The company is looking to expand its presence over time. It will allow companies to build real-world agents in many different ways, such as building robots, creating artificial intelligence, and more. The new product is available for purchase in the UK. In addition, the company has announced that it will be able to build one of the most effective agents in the world.<br>
56
+ '''
57
+ )
58
  text_input = gr.Textbox(label = "Input")
59
  text_output = gr.Textbox(label = "Output")
60
+
61
  b1 = gr.Button("Generate headline")
62
  b2 = gr.Button("Generate long content")
63