Preetham04 commited on
Commit
a4671ce
·
verified ·
1 Parent(s): b0fdb33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -2
app.py CHANGED
@@ -1,4 +1,4 @@
1
- import gradio as gr
2
  from transformers import pipeline
3
 
4
  pipeline = pipeline(task="text-generation", model="Preetham04/text-generation")
@@ -15,4 +15,31 @@ gradio_app = gr.Interface(
15
  )
16
 
17
  if __name__ == "__main__":
18
- gradio_app.launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """import gradio as gr
2
  from transformers import pipeline
3
 
4
  pipeline = pipeline(task="text-generation", model="Preetham04/text-generation")
 
15
  )
16
 
17
  if __name__ == "__main__":
18
+ gradio_app.launch(share=True)
19
+ """
20
+ import gradio as gr
21
+
22
+ from transformers import pipeline
23
+
24
+ pipe = pipeline("text-generation", model="Preetham04/text-generation")
25
+
26
+
27
+ def generate(text):
28
+ return pipe(text)[0]["title"]
29
+
30
+
31
+ with gr.Blocks() as demo:
32
+ with gr.Row():
33
+ with gr.Column():
34
+ find = gr.Textbox(label="input text")
35
+ search_btn = gr.Button(value="SEARCH")
36
+ with gr.Column():
37
+ found = gr.Textbox(label="Related searches")
38
+
39
+ search_btn.click(generate, inputs=find, outputs=found)
40
+ examples = gr.Examples(examples=["SDE", "UX"],
41
+ inputs=[english])
42
+
43
+ demo.launch()
44
+
45
+