Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ def _parse_labels(label_text: str):
|
|
| 40 |
return list(labels.keys())
|
| 41 |
|
| 42 |
|
| 43 |
-
@spaces.GPU(duration=
|
| 44 |
def extract_entities(
|
| 45 |
text: str,
|
| 46 |
labels: str,
|
|
@@ -77,7 +77,7 @@ def extract_entities(
|
|
| 77 |
return json.dumps({"error": str(e)}, indent=2)
|
| 78 |
|
| 79 |
|
| 80 |
-
@spaces.GPU(duration=
|
| 81 |
def classify_text(
|
| 82 |
text: str,
|
| 83 |
tasks_text: str,
|
|
@@ -110,7 +110,7 @@ def classify_text(
|
|
| 110 |
return json.dumps({"error": str(e)}, indent=2)
|
| 111 |
|
| 112 |
|
| 113 |
-
@spaces.GPU(duration=
|
| 114 |
def extract_relations(
|
| 115 |
text: str,
|
| 116 |
relation_types: str,
|
|
@@ -264,8 +264,6 @@ CSS = """
|
|
| 264 |
"""
|
| 265 |
|
| 266 |
with gr.Blocks(
|
| 267 |
-
theme=gr.themes.Citrus(),
|
| 268 |
-
css=CSS,
|
| 269 |
title="GLiNER2.5-base — Information Extraction",
|
| 270 |
) as demo:
|
| 271 |
gr.Markdown("""
|
|
@@ -412,4 +410,4 @@ with gr.Blocks(
|
|
| 412 |
|
| 413 |
|
| 414 |
if __name__ == "__main__":
|
| 415 |
-
demo.launch(mcp_server=True)
|
|
|
|
| 40 |
return list(labels.keys())
|
| 41 |
|
| 42 |
|
| 43 |
+
@spaces.GPU(duration=15)
|
| 44 |
def extract_entities(
|
| 45 |
text: str,
|
| 46 |
labels: str,
|
|
|
|
| 77 |
return json.dumps({"error": str(e)}, indent=2)
|
| 78 |
|
| 79 |
|
| 80 |
+
@spaces.GPU(duration=15)
|
| 81 |
def classify_text(
|
| 82 |
text: str,
|
| 83 |
tasks_text: str,
|
|
|
|
| 110 |
return json.dumps({"error": str(e)}, indent=2)
|
| 111 |
|
| 112 |
|
| 113 |
+
@spaces.GPU(duration=15)
|
| 114 |
def extract_relations(
|
| 115 |
text: str,
|
| 116 |
relation_types: str,
|
|
|
|
| 264 |
"""
|
| 265 |
|
| 266 |
with gr.Blocks(
|
|
|
|
|
|
|
| 267 |
title="GLiNER2.5-base — Information Extraction",
|
| 268 |
) as demo:
|
| 269 |
gr.Markdown("""
|
|
|
|
| 410 |
|
| 411 |
|
| 412 |
if __name__ == "__main__":
|
| 413 |
+
demo.launch(mcp_server=True, theme=gr.themes.Citrus(), css=CSS)
|