Hwilner commited on
Commit
0fadadf
1 Parent(s): 1434c03

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+
4
+ # Use a pipeline as a high-level helper
5
+ from transformers import pipeline
6
+
7
+ text_summary = pipeline("summarization", model="dicta-il/dictalm2.0", torch_dtype=torch.bfloat16)
8
+
9
+ =
10
+ text_summary = pipeline("summarization", model=model_path,
11
+ torch_dtype=torch.bfloat16)
12
+
13
+
14
+
15
+ # text='''Elon Reeve Musk (/ˈiːlɒn/ EE-lon; born June 28, 1971) is a businessman and investor.
16
+ # He is the founder, chairman, CEO, and CTO of SpaceX; angel investor, CEO, product architect,
17
+ # and former chairman of Tesla, Inc.; owner, executive chairman, and CTO of X Corp.;
18
+ # founder of the Boring Company and xAI; co-founder of Neuralink and OpenAI; and president
19
+ # of the Musk Foundation. He is one of the wealthiest people in the world; as of April 2024,
20
+ # Forbes estimates his net worth to be $178 billion.[4]'''
21
+ # print(text_summary(text));
22
+
23
+ def summary (input):
24
+ output = text_summary(input)
25
+ return output[0]['summary_text']
26
+
27
+ gr.close_all()
28
+
29
+ # demo = gr.Interface(fn=summary, inputs="text",outputs="text")
30
+ demo = gr.Interface(fn=summary,
31
+ inputs=[gr.Textbox(label="Input text to summarize",lines=6)],
32
+ outputs=[gr.Textbox(label="Summarized text",lines=4)],
33
+ title="@GenAILearniverse Project 1: Text Summarizer",
34
+ description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")
35
+ demo.launch()