input validation
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import gradio as gr
|
|
2 |
import aiohttp
|
3 |
import asyncio
|
4 |
import os
|
5 |
-
import re
|
6 |
|
7 |
# API endpoint - model name
|
8 |
API_URL = "https://api-inference.huggingface.co/models/Rahmat82/t5-small-finetuned-summarization-xsum"
|
@@ -10,7 +9,7 @@ SECRET_KEY = os.environ.get("summarizer")
|
|
10 |
|
11 |
# asynchronous function
|
12 |
async def summarize(text, retries=3):
|
13 |
-
if len(
|
14 |
return "⛔ You input is too short! It should contain more than a few sentences for summarization."
|
15 |
headers = {"Authorization": f"Bearer {SECRET_KEY}"}
|
16 |
data = {
|
|
|
2 |
import aiohttp
|
3 |
import asyncio
|
4 |
import os
|
|
|
5 |
|
6 |
# API endpoint - model name
|
7 |
API_URL = "https://api-inference.huggingface.co/models/Rahmat82/t5-small-finetuned-summarization-xsum"
|
|
|
9 |
|
10 |
# asynchronous function
|
11 |
async def summarize(text, retries=3):
|
12 |
+
if len(text)<250:
|
13 |
return "⛔ You input is too short! It should contain more than a few sentences for summarization."
|
14 |
headers = {"Authorization": f"Bearer {SECRET_KEY}"}
|
15 |
data = {
|