Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
-
sdk_version: 5.
|
9 |
app_file: run.py
|
10 |
pinned: false
|
11 |
hf_oauth: true
|
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
+
sdk_version: 5.43.0
|
9 |
app_file: run.py
|
10 |
pinned: false
|
11 |
hf_oauth: true
|
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: ner_pipeline"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio torch transformers"]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["from transformers import pipeline\n", "\n", "import gradio as gr\n", "\n", "ner_pipeline = pipeline(\"ner\")\n", "\n", "examples = [\n", " \"Does Chicago have any stores and does Joe live here?\",\n", "]\n", "\n", "def ner(text):\n", " output = ner_pipeline(text)\n", " return {\"text\": text, \"entities\": output}\n", "\n", "demo = gr.Interface(ner,\n", " gr.Textbox(placeholder=\"Enter sentence here...\"),\n", " gr.HighlightedText(),\n", " examples=examples)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: ner_pipeline"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio torch transformers"]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["from transformers import pipeline\n", "\n", "import gradio as gr\n", "\n", "ner_pipeline = pipeline(\"ner\") # type: ignore\n", "\n", "examples = [\n", " \"Does Chicago have any stores and does Joe live here?\",\n", "]\n", "\n", "def ner(text):\n", " output = ner_pipeline(text)\n", " return {\"text\": text, \"entities\": output}\n", "\n", "demo = gr.Interface(ner,\n", " gr.Textbox(placeholder=\"Enter sentence here...\"),\n", " gr.HighlightedText(),\n", " examples=examples)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -2,7 +2,7 @@ from transformers import pipeline
|
|
2 |
|
3 |
import gradio as gr
|
4 |
|
5 |
-
ner_pipeline = pipeline("ner")
|
6 |
|
7 |
examples = [
|
8 |
"Does Chicago have any stores and does Joe live here?",
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
|
5 |
+
ner_pipeline = pipeline("ner") # type: ignore
|
6 |
|
7 |
examples = [
|
8 |
"Does Chicago have any stores and does Joe live here?",
|