Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,18 +41,35 @@ def prediction(text):
|
|
| 41 |
select_length = int(len(sentence_tokens)*0.3)
|
| 42 |
summary = nlargest(select_length, sentence_scores, key = sentence_scores.get)
|
| 43 |
return summary
|
| 44 |
-
INPUTS = gr.inputs.
|
| 45 |
-
text = """
|
| 46 |
-
Maria Sharapova has basically no friends as tennis players on the WTA Tour. The Russian player has no problems in openly speaking about it and in a recent interview she said: 'I don't really hide any feelings too much.
|
| 47 |
-
I think everyone knows this is my job here. When I'm on the courts or when I'm on the court playing, I'm a competitor and I want to beat every single person whether they're in the locker room or across the net.
|
| 48 |
-
So I'm not the one to strike up a conversation about the weather and know that in the next few minutes I have to go and try to win a tennis match.
|
| 49 |
-
I'm a pretty competitive girl. I say my hellos, but I'm not sending any players flowers as well. Uhm, I'm not really friendly or close to many players.
|
| 50 |
-
I have not a lot of friends away from the courts.' When she said she is not really close to a lot of players, is that something strategic that she is doing? Is it different on the men's tour than the women's tour? 'No, not at all.
|
| 51 |
-
I think just because you're in the same sport doesn't mean that you have to be friends with everyone just because you're categorized, you're a tennis player, so you're going to get along with tennis players.
|
| 52 |
-
I think every person has different interests. I have friends that have completely different jobs and interests, and I've met them in very different parts of my life.
|
| 53 |
-
I think everyone just thinks because we're tennis players we should be the greatest of friends. But ultimately tennis is just a very small part of what we do.
|
| 54 |
-
There are so many other things that we're interested in, that we do.'
|
| 55 |
-
"""
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
select_length = int(len(sentence_tokens)*0.3)
|
| 42 |
summary = nlargest(select_length, sentence_scores, key = sentence_scores.get)
|
| 43 |
return summary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
#text = """
|
| 46 |
+
# Maria Sharapova has basically no friends as tennis players on the WTA Tour. The Russian player has no problems in openly speaking about it and in a recent interview she said: 'I don't really hide any feelings too much.
|
| 47 |
+
# I think everyone knows this is my job here. When I'm on the courts or when I'm on the court playing, I'm a competitor and I want to beat every single person whether they're in the locker room or across the net.
|
| 48 |
+
# So I'm not the one to strike up a conversation about the weather and know that in the next few minutes I have to go and try to win a tennis match.
|
| 49 |
+
#I'm a pretty competitive girl. I say my hellos, but I'm not sending any players flowers as well. Uhm, I'm not really friendly or close to many players.
|
| 50 |
+
# I have not a lot of friends away from the courts.' When she said she is not really close to a lot of players, is that something strategic that she is doing? Is it different on the men's tour than the women's tour? 'No, not at all.
|
| 51 |
+
#I think just because you're in the same sport doesn't mean that you have to be friends with everyone just because you're categorized, you're a tennis player, so you're going to get along with tennis players.
|
| 52 |
+
#I think every person has different interests. I have friends that have completely different jobs and interests, and I've met them in very different parts of my life.
|
| 53 |
+
#I think everyone just thinks because we're tennis players we should be the greatest of friends. But ultimately tennis is just a very small part of what we do.
|
| 54 |
+
#There are so many other things that we're interested in, that we do.'
|
| 55 |
+
#"""
|
| 56 |
+
#predicted_label, score = occ_predict("img1.jpg")
|
| 57 |
+
#inputs = gr.inputs.text(label)
|
| 58 |
+
#label = gr.outputs.Label(num_top_classes=2)
|
| 59 |
+
#EXAMPLES = ["img1.png","img2.png","img3.png","img10.png","img8.png","img9.png"]
|
| 60 |
+
#DESCRIPTION = "Occlusion means the act of closing, blocking or shutting something or the state of being closed or blocked"
|
| 61 |
+
#summary = prediction(text)
|
| 62 |
+
#print(summary)
|
| 63 |
+
|
| 64 |
+
demo_app = gr.Interface(
|
| 65 |
+
fn=prediction,
|
| 66 |
+
inputs=gr.input.text(label = " Text", max_lines = 20),
|
| 67 |
+
outputs= "text",
|
| 68 |
+
title = "Text Summarization",
|
| 69 |
+
#description = DESCRIPTION,
|
| 70 |
+
examples = EXAMPLES,
|
| 71 |
+
cache_example = True,
|
| 72 |
+
live = True,
|
| 73 |
+
theme = 'huggingface'
|
| 74 |
+
)
|
| 75 |
+
demo_app.launch(debug=True, enable_queue = True)
|