Spaces:
Runtime error
Runtime error
Samson
commited on
Commit
•
85bd369
1
Parent(s):
72ee014
dabbling
Browse files- app.py +23 -6
- requirements.txt +2 -2
app.py
CHANGED
@@ -1,9 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
inputs=gr.Textbox(lines=2, placeholder="Name Here..."),
|
8 |
-
outputs="text")
|
9 |
-
iface.launch()
|
|
|
1 |
+
# import gradio as gr
|
2 |
+
|
3 |
+
# def greet(name):
|
4 |
+
# return "Hello " + name + "!!... How are you doing today"
|
5 |
+
|
6 |
+
# iface = gr.Interface(fn=greet,
|
7 |
+
# inputs=gr.Textbox(lines=2, placeholder="Name Here..."),
|
8 |
+
# outputs="text")
|
9 |
+
# iface.launch()
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
from transformers import pipeline
|
14 |
import gradio as gr
|
15 |
|
16 |
+
model = pipeline('summarization')
|
17 |
+
|
18 |
+
def predict(prompt):
|
19 |
+
summary = model(prompt)[0]["summary_text"]
|
20 |
+
return summary
|
21 |
+
|
22 |
+
with gr.Blocks() as demo:
|
23 |
+
textbox = gr.Textbox(placeholder="Enter what you need to summarize", lines = 4)
|
24 |
+
gr.Interface(fn=predict, input=textbox, output='text')
|
25 |
|
26 |
+
demo.launch()
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
|
2 |
-
|
|
|
1 |
+
transformers
|
2 |
+
pipeline
|