aliabd HF Staff commited on
Commit
a4293a1
·
1 Parent(s): 52c28fb

Upload with huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +7 -8
  2. requirements.txt +2 -0
  3. run.ipynb +1 -0
  4. run.py +204 -0
README.md CHANGED
@@ -1,12 +1,11 @@
 
1
  ---
2
- title: Markdown Example Main
3
- emoji: 👁
4
- colorFrom: red
5
- colorTo: blue
6
  sdk: gradio
7
- sdk_version: 3.20.0
8
- app_file: app.py
9
  pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: markdown_example_main
4
+ emoji: 🔥
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 3.20.1
9
+ app_file: run.py
10
  pinned: false
11
  ---
 
 
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+
2
+ https://gradio-main-build.s3.amazonaws.com/a5e3be71ba0ddb5d5f33fff72a1aaf0a4ecc9257/gradio-3.20.1-py3-none-any.whl
run.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: markdown_example"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "css = (\n", " \"footer {display: none !important;} .gradio-container {min-height: 0px !important;}\"\n", ")\n", "\n", "# sample md stolen from https://dillinger.io/\n", "\n", "md = \"\"\"# Dillinger\n", "## _The Last Markdown Editor, Ever_\n", "\n", "[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)\n", "\n", "Dillinger is a cloud-enabled, mobile-ready, offline-storage compatible,\n", "AngularJS-powered HTML5 Markdown editor.\n", "\n", "- Type some Markdown on the left\n", "- See HTML in the right\n", "- \u2728Magic \u2728\n", "\n", "## Features\n", "\n", "- Import a HTML file and watch it magically convert to Markdown\n", "- Drag and drop images (requires your Dropbox account be linked)\n", "- Import and save files from GitHub, Dropbox, Google Drive and One Drive\n", "- Drag and drop markdown and HTML files into Dillinger\n", "- Export documents as Markdown, HTML and PDF\n", "\n", "Markdown is a lightweight markup language based on the formatting conventions\n", "that people naturally use in email.\n", "As [John Gruber] writes on the [Markdown site][df1]\n", "\n", "> The overriding design goal for Markdown's\n", "> formatting syntax is to make it as readable\n", "> as possible. The idea is that a\n", "> Markdown-formatted document should be\n", "> publishable as-is, as plain text, without\n", "> looking like it's been marked up with tags\n", "> or formatting instructions.\n", "\n", "This text you see here is *actually- written in Markdown! To get a feel\n", "for Markdown's syntax, type some text into the left window and\n", "watch the results in the right.\n", "\n", "## Tech\n", "\n", "Dillinger uses a number of open source projects to work properly:\n", "\n", "- [AngularJS] - HTML enhanced for web apps!\n", "- [Ace Editor] - awesome web-based text editor\n", "- [markdown-it] - Markdown parser done right. Fast and easy to extend.\n", "- [Twitter Bootstrap] - great UI boilerplate for modern web apps\n", "- [node.js] - evented I/O for the backend\n", "- [Express] - fast node.js network app framework [@tjholowaychuk]\n", "- [Gulp] - the streaming build system\n", "- [Breakdance](https://breakdance.github.io/breakdance/) - HTML\n", "to Markdown converter\n", "- [jQuery] - duh\n", "\n", "And of course Dillinger itself is open source with a [public repository][dill]\n", " on GitHub.\n", "\n", "## Installation\n", "\n", "Dillinger requires [Node.js](https://nodejs.org/) v10+ to run.\n", "\n", "Install the dependencies and devDependencies and start the server.\n", "\n", "```sh\n", "cd dillinger\n", "npm i\n", "node app\n", "```\n", "\n", "For production environments...\n", "\n", "```sh\n", "npm install --production\n", "NODE_ENV=production node app\n", "```\n", "\n", "## Plugins\n", "\n", "Dillinger is currently extended with the following plugins.\n", "Instructions on how to use them in your own application are linked below.\n", "\n", "| Plugin | README |\n", "| ------ | ------ |\n", "| Dropbox | [plugins/dropbox/README.md][PlDb] |\n", "| GitHub | [plugins/github/README.md][PlGh] |\n", "| Google Drive | [plugins/googledrive/README.md][PlGd] |\n", "| OneDrive | [plugins/onedrive/README.md][PlOd] |\n", "| Medium | [plugins/medium/README.md][PlMe] |\n", "| Google Analytics | [plugins/googleanalytics/README.md][PlGa] |\n", "\n", "## Development\n", "\n", "Want to contribute? Great!\n", "\n", "Dillinger uses Gulp + Webpack for fast developing.\n", "Make a change in your file and instantaneously see your updates!\n", "\n", "Open your favorite Terminal and run these commands.\n", "\n", "First Tab:\n", "\n", "```sh\n", "node app\n", "```\n", "\n", "Second Tab:\n", "\n", "```sh\n", "gulp watch\n", "```\n", "\n", "(optional) Third:\n", "\n", "```sh\n", "karma test\n", "```\n", "\n", "#### Building for source\n", "\n", "For production release:\n", "\n", "```sh\n", "gulp build --prod\n", "```\n", "\n", "Generating pre-built zip archives for distribution:\n", "\n", "```sh\n", "gulp build dist --prod\n", "```\n", "\n", "## Docker\n", "\n", "Dillinger is very easy to install and deploy in a Docker container.\n", "\n", "By default, the Docker will expose port 8080, so change this within the\n", "Dockerfile if necessary. When ready, simply use the Dockerfile to\n", "build the image.\n", "\n", "```sh\n", "cd dillinger\n", "docker build -t <youruser>/dillinger:${package.json.version} .\n", "```\n", "\n", "This will create the dillinger image and pull in the necessary dependencies.\n", "Be sure to swap out `${package.json.version}` with the actual\n", "version of Dillinger.\n", "\n", "Once done, run the Docker image and map the port to whatever you wish on\n", "your host. In this example, we simply map port 8000 of the host to\n", "port 8080 of the Docker (or whatever port was exposed in the Dockerfile):\n", "\n", "```sh\n", "docker run -d -p 8000:8080 --restart=always --cap-add=SYS_ADMIN --name=dillinger <youruser>/dillinger:${package.json.version}\n", "```\n", "\n", "> Note: `--capt-add=SYS-ADMIN` is required for PDF rendering.\n", "\n", "Verify the deployment by navigating to your server address in\n", "your preferred browser.\n", "\n", "```sh\n", "127.0.0.1:8000\n", "```\n", "\n", "## License\n", "\n", "MIT\n", "\n", "**Free Software, Hell Yeah!**\n", "\n", "[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)\n", "\n", " [dill]: <https://github.com/joemccann/dillinger>\n", " [git-repo-url]: <https://github.com/joemccann/dillinger.git>\n", " [john gruber]: <http://daringfireball.net>\n", " [df1]: <http://daringfireball.net/projects/markdown/>\n", " [markdown-it]: <https://github.com/markdown-it/markdown-it>\n", " [Ace Editor]: <http://ace.ajax.org>\n", " [node.js]: <http://nodejs.org>\n", " [Twitter Bootstrap]: <http://twitter.github.com/bootstrap/>\n", " [jQuery]: <http://jquery.com>\n", " [@tjholowaychuk]: <http://twitter.com/tjholowaychuk>\n", " [express]: <http://expressjs.com>\n", " [AngularJS]: <http://angularjs.org>\n", " [Gulp]: <http://gulpjs.com>\n", "\n", " [PlDb]: <https://github.com/joemccann/dillinger/tree/master/plugins/dropbox/README.md>\n", " [PlGh]: <https://github.com/joemccann/dillinger/tree/master/plugins/github/README.md>\n", " [PlGd]: <https://github.com/joemccann/dillinger/tree/master/plugins/googledrive/README.md>\n", " [PlOd]: <https://github.com/joemccann/dillinger/tree/master/plugins/onedrive/README.md>\n", " [PlMe]: <https://github.com/joemccann/dillinger/tree/master/plugins/medium/README.md>\n", " [PlGa]: <https://github.com/RahulHP/dillinger/blob/master/plugins/googleanalytics/README.md>\n", "\n", "\"\"\"\n", "with gr.Blocks(css=css) as demo:\n", " gr.Markdown(value=md)\n", "\n", "demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ css = (
4
+ "footer {display: none !important;} .gradio-container {min-height: 0px !important;}"
5
+ )
6
+
7
+ # sample md stolen from https://dillinger.io/
8
+
9
+ md = """# Dillinger
10
+ ## _The Last Markdown Editor, Ever_
11
+
12
+ [![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)
13
+
14
+ Dillinger is a cloud-enabled, mobile-ready, offline-storage compatible,
15
+ AngularJS-powered HTML5 Markdown editor.
16
+
17
+ - Type some Markdown on the left
18
+ - See HTML in the right
19
+ - ✨Magic ✨
20
+
21
+ ## Features
22
+
23
+ - Import a HTML file and watch it magically convert to Markdown
24
+ - Drag and drop images (requires your Dropbox account be linked)
25
+ - Import and save files from GitHub, Dropbox, Google Drive and One Drive
26
+ - Drag and drop markdown and HTML files into Dillinger
27
+ - Export documents as Markdown, HTML and PDF
28
+
29
+ Markdown is a lightweight markup language based on the formatting conventions
30
+ that people naturally use in email.
31
+ As [John Gruber] writes on the [Markdown site][df1]
32
+
33
+ > The overriding design goal for Markdown's
34
+ > formatting syntax is to make it as readable
35
+ > as possible. The idea is that a
36
+ > Markdown-formatted document should be
37
+ > publishable as-is, as plain text, without
38
+ > looking like it's been marked up with tags
39
+ > or formatting instructions.
40
+
41
+ This text you see here is *actually- written in Markdown! To get a feel
42
+ for Markdown's syntax, type some text into the left window and
43
+ watch the results in the right.
44
+
45
+ ## Tech
46
+
47
+ Dillinger uses a number of open source projects to work properly:
48
+
49
+ - [AngularJS] - HTML enhanced for web apps!
50
+ - [Ace Editor] - awesome web-based text editor
51
+ - [markdown-it] - Markdown parser done right. Fast and easy to extend.
52
+ - [Twitter Bootstrap] - great UI boilerplate for modern web apps
53
+ - [node.js] - evented I/O for the backend
54
+ - [Express] - fast node.js network app framework [@tjholowaychuk]
55
+ - [Gulp] - the streaming build system
56
+ - [Breakdance](https://breakdance.github.io/breakdance/) - HTML
57
+ to Markdown converter
58
+ - [jQuery] - duh
59
+
60
+ And of course Dillinger itself is open source with a [public repository][dill]
61
+ on GitHub.
62
+
63
+ ## Installation
64
+
65
+ Dillinger requires [Node.js](https://nodejs.org/) v10+ to run.
66
+
67
+ Install the dependencies and devDependencies and start the server.
68
+
69
+ ```sh
70
+ cd dillinger
71
+ npm i
72
+ node app
73
+ ```
74
+
75
+ For production environments...
76
+
77
+ ```sh
78
+ npm install --production
79
+ NODE_ENV=production node app
80
+ ```
81
+
82
+ ## Plugins
83
+
84
+ Dillinger is currently extended with the following plugins.
85
+ Instructions on how to use them in your own application are linked below.
86
+
87
+ | Plugin | README |
88
+ | ------ | ------ |
89
+ | Dropbox | [plugins/dropbox/README.md][PlDb] |
90
+ | GitHub | [plugins/github/README.md][PlGh] |
91
+ | Google Drive | [plugins/googledrive/README.md][PlGd] |
92
+ | OneDrive | [plugins/onedrive/README.md][PlOd] |
93
+ | Medium | [plugins/medium/README.md][PlMe] |
94
+ | Google Analytics | [plugins/googleanalytics/README.md][PlGa] |
95
+
96
+ ## Development
97
+
98
+ Want to contribute? Great!
99
+
100
+ Dillinger uses Gulp + Webpack for fast developing.
101
+ Make a change in your file and instantaneously see your updates!
102
+
103
+ Open your favorite Terminal and run these commands.
104
+
105
+ First Tab:
106
+
107
+ ```sh
108
+ node app
109
+ ```
110
+
111
+ Second Tab:
112
+
113
+ ```sh
114
+ gulp watch
115
+ ```
116
+
117
+ (optional) Third:
118
+
119
+ ```sh
120
+ karma test
121
+ ```
122
+
123
+ #### Building for source
124
+
125
+ For production release:
126
+
127
+ ```sh
128
+ gulp build --prod
129
+ ```
130
+
131
+ Generating pre-built zip archives for distribution:
132
+
133
+ ```sh
134
+ gulp build dist --prod
135
+ ```
136
+
137
+ ## Docker
138
+
139
+ Dillinger is very easy to install and deploy in a Docker container.
140
+
141
+ By default, the Docker will expose port 8080, so change this within the
142
+ Dockerfile if necessary. When ready, simply use the Dockerfile to
143
+ build the image.
144
+
145
+ ```sh
146
+ cd dillinger
147
+ docker build -t <youruser>/dillinger:${package.json.version} .
148
+ ```
149
+
150
+ This will create the dillinger image and pull in the necessary dependencies.
151
+ Be sure to swap out `${package.json.version}` with the actual
152
+ version of Dillinger.
153
+
154
+ Once done, run the Docker image and map the port to whatever you wish on
155
+ your host. In this example, we simply map port 8000 of the host to
156
+ port 8080 of the Docker (or whatever port was exposed in the Dockerfile):
157
+
158
+ ```sh
159
+ docker run -d -p 8000:8080 --restart=always --cap-add=SYS_ADMIN --name=dillinger <youruser>/dillinger:${package.json.version}
160
+ ```
161
+
162
+ > Note: `--capt-add=SYS-ADMIN` is required for PDF rendering.
163
+
164
+ Verify the deployment by navigating to your server address in
165
+ your preferred browser.
166
+
167
+ ```sh
168
+ 127.0.0.1:8000
169
+ ```
170
+
171
+ ## License
172
+
173
+ MIT
174
+
175
+ **Free Software, Hell Yeah!**
176
+
177
+ [//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
178
+
179
+ [dill]: <https://github.com/joemccann/dillinger>
180
+ [git-repo-url]: <https://github.com/joemccann/dillinger.git>
181
+ [john gruber]: <http://daringfireball.net>
182
+ [df1]: <http://daringfireball.net/projects/markdown/>
183
+ [markdown-it]: <https://github.com/markdown-it/markdown-it>
184
+ [Ace Editor]: <http://ace.ajax.org>
185
+ [node.js]: <http://nodejs.org>
186
+ [Twitter Bootstrap]: <http://twitter.github.com/bootstrap/>
187
+ [jQuery]: <http://jquery.com>
188
+ [@tjholowaychuk]: <http://twitter.com/tjholowaychuk>
189
+ [express]: <http://expressjs.com>
190
+ [AngularJS]: <http://angularjs.org>
191
+ [Gulp]: <http://gulpjs.com>
192
+
193
+ [PlDb]: <https://github.com/joemccann/dillinger/tree/master/plugins/dropbox/README.md>
194
+ [PlGh]: <https://github.com/joemccann/dillinger/tree/master/plugins/github/README.md>
195
+ [PlGd]: <https://github.com/joemccann/dillinger/tree/master/plugins/googledrive/README.md>
196
+ [PlOd]: <https://github.com/joemccann/dillinger/tree/master/plugins/onedrive/README.md>
197
+ [PlMe]: <https://github.com/joemccann/dillinger/tree/master/plugins/medium/README.md>
198
+ [PlGa]: <https://github.com/RahulHP/dillinger/blob/master/plugins/googleanalytics/README.md>
199
+
200
+ """
201
+ with gr.Blocks(css=css) as demo:
202
+ gr.Markdown(value=md)
203
+
204
+ demo.launch()