freddyaboulton commited on
Commit
5d1591d
·
verified ·
1 Parent(s): b1157d5

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. requirements.txt +2 -2
  3. run.ipynb +1 -1
  4. run.py +1 -0
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
- sdk_version: 5.49.1
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
 
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 6.0.0
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@e05eb8df38a4ca20993e94ca4e209cf8110bb677#subdirectory=client/python
2
- https://gradio-pypi-previews.s3.amazonaws.com/e05eb8df38a4ca20993e94ca4e209cf8110bb677/gradio-5.49.1-py3-none-any.whl
3
  spacy
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@d007e6cf617baba5c62e49ec2b7ce278aa863a79#subdirectory=client/python
2
+ https://gradio-pypi-previews.s3.amazonaws.com/d007e6cf617baba5c62e49ec2b7ce278aa863a79/gradio-6.0.0-py3-none-any.whl
3
  spacy
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: text_analysis\n", "### This simple demo takes advantage of Gradio's HighlightedText, JSON and HTML outputs to create a clear NER segmentation.\n", " "]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio spacy"]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import os\n", "os.system('python -m spacy download en_core_web_sm')\n", "import spacy # type: ignore\n", "from spacy import displacy # type: ignore\n", "\n", "nlp = spacy.load(\"en_core_web_sm\")\n", "\n", "def text_analysis(text):\n", " doc = nlp(text)\n", " html = displacy.render(doc, style=\"dep\", page=True)\n", " html = (\n", " \"<div style='max-width:100%; max-height:360px; overflow:auto'>\"\n", " + html\n", " + \"</div>\"\n", " )\n", " pos_count = {\n", " \"char_count\": len(text),\n", " \"token_count\": 0,\n", " }\n", " pos_tokens = []\n", "\n", " for token in doc:\n", " pos_tokens.extend([(token.text, token.pos_), (\" \", None)])\n", "\n", " return pos_tokens, pos_count, html\n", "\n", "demo = gr.Interface(\n", " text_analysis,\n", " gr.Textbox(placeholder=\"Enter sentence here...\"),\n", " [\"highlight\", \"json\", \"html\"],\n", " examples=[\n", " [\"What a beautiful morning for a walk!\"],\n", " [\"It was the best of times, it was the worst of times.\"],\n", " ],\n", ")\n", "\n", "demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: text_analysis\n", "### This simple demo takes advantage of Gradio's HighlightedText, JSON and HTML outputs to create a clear NER segmentation.\n", " "]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio spacy"]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import os\n", "os.system('python -m spacy download en_core_web_sm')\n", "import spacy # type: ignore\n", "from spacy import displacy # type: ignore\n", "\n", "nlp = spacy.load(\"en_core_web_sm\")\n", "\n", "def text_analysis(text):\n", " doc = nlp(text)\n", " html = displacy.render(doc, style=\"dep\", page=True)\n", " html = (\n", " \"<div style='max-width:100%; max-height:360px; overflow:auto'>\"\n", " + html\n", " + \"</div>\"\n", " )\n", " pos_count = {\n", " \"char_count\": len(text),\n", " \"token_count\": 0,\n", " }\n", " pos_tokens = []\n", "\n", " for token in doc:\n", " pos_tokens.extend([(token.text, token.pos_), (\" \", None)])\n", "\n", " return pos_tokens, pos_count, html\n", "\n", "demo = gr.Interface(\n", " text_analysis,\n", " gr.Textbox(placeholder=\"Enter sentence here...\"),\n", " [\"highlight\", \"json\", \"html\"],\n", " examples=[\n", " [\"What a beautiful morning for a walk!\"],\n", " [\"It was the best of times, it was the worst of times.\"],\n", " ],\n", " api_name=\"predict\",\n", ")\n", "\n", "demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -33,6 +33,7 @@ demo = gr.Interface(
33
  ["What a beautiful morning for a walk!"],
34
  ["It was the best of times, it was the worst of times."],
35
  ],
 
36
  )
37
 
38
  demo.launch()
 
33
  ["What a beautiful morning for a walk!"],
34
  ["It was the best of times, it was the worst of times."],
35
  ],
36
+ api_name="predict",
37
  )
38
 
39
  demo.launch()