Felguk commited on
Commit
08125cf
·
verified ·
1 Parent(s): e39100e

Create run.ipynb

Browse files
Files changed (1) hide show
  1. run.ipynb +85 -0
run.ipynb ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "# Install Gradio\n",
10
+ "!pip install gradio"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": null,
16
+ "metadata": {},
17
+ "outputs": [],
18
+ "source": [
19
+ "# Import Gradio\n",
20
+ "import gradio as gr"
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "code",
25
+ "execution_count": null,
26
+ "metadata": {},
27
+ "outputs": [],
28
+ "source": [
29
+ "# Define the paint function\n",
30
+ "def paint_canvas(image):\n",
31
+ " # Simply return the image as is\n",
32
+ " return image"
33
+ ]
34
+ },
35
+ {
36
+ "cell_type": "code",
37
+ "execution_count": null,
38
+ "metadata": {},
39
+ "outputs": [],
40
+ "source": [
41
+ "# Create the Gradio interface\n",
42
+ "iface = gr.Interface(\n",
43
+ " fn=paint_canvas, # Function to call\n",
44
+ " inputs=\"sketchpad\", # Input is a sketchpad\n",
45
+ " outputs=\"image\", # Output is an image\n",
46
+ " live=True, # Real-time updates\n",
47
+ " title=\"Paint Canvas\", # Title of the app\n",
48
+ " description=\"Draw something on the canvas and see it displayed below!\", # Description\n",
49
+ " theme=\"gstaff/xkcd\" # Apply the xkcd comic-style theme\n",
50
+ ")"
51
+ ]
52
+ },
53
+ {
54
+ "cell_type": "code",
55
+ "execution_count": null,
56
+ "metadata": {},
57
+ "outputs": [],
58
+ "source": [
59
+ "# Launch the interface\n",
60
+ "iface.launch(inline=True) # Embed the interface in the notebook"
61
+ ]
62
+ }
63
+ ],
64
+ "metadata": {
65
+ "kernelspec": {
66
+ "display_name": "Python 3",
67
+ "language": "python",
68
+ "name": "python3"
69
+ },
70
+ "language_info": {
71
+ "codemirror_mode": {
72
+ "name": "ipython",
73
+ "version": 3
74
+ },
75
+ "file_extension": ".py",
76
+ "mimetype": "text/x-python",
77
+ "name": "python",
78
+ "nbconvert_exporter": "python",
79
+ "pygments_lexer": "ipython3",
80
+ "version": "3.9.0"
81
+ }
82
+ },
83
+ "nbformat": 4,
84
+ "nbformat_minor": 5
85
+ }