Omnibus commited on
Commit
fb318bf
0 Parent(s):

Duplicate from Omnibus/First-Space-Gradio-Template

Browse files
Files changed (3) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +33 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: First Space Gradio Template
3
+ emoji: 🐢
4
+ colorFrom: green
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 3.16.2
8
+ app_file: app.py
9
+ pinned: false
10
+ duplicated_from: Omnibus/First-Space-Gradio-Template
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import all of the modules you will be using here
2
+ # you can import them "as" any alias name for ease
3
+ import gradio as gr
4
+
5
+ # load a model or space here as a variable to use later
6
+ my_model = gr.Interface.load("models/runwayml/stable-diffusion-v1-5")
7
+
8
+ # add a function that will do all the work by defining it here
9
+ def my_function(my_input):
10
+ # use the loaded model variable to process the input
11
+ # this example uses a text-to-image model, so our input will be text, and our output will be an image
12
+ my_output = my_model(my_input)
13
+ return my_output
14
+
15
+ # build a user interface using Gradio Blocks
16
+ with gr.Blocks() as my_demo:
17
+
18
+ # a text input box to collect the input
19
+ my_input = gr.Textbox(label="Input Text Here")
20
+
21
+ # a button that will start the process
22
+ my_button = gr.Button(label="Run")
23
+
24
+ # an output Image window to display the returned image
25
+ my_output = gr.Image(label="Returned Image")
26
+
27
+ # a listener to watch for the button to be clicked
28
+ # when the button is clicked, it will send the "my_input" text to the "my_function" function,
29
+ # and return the output to the "my_output" Image window
30
+ my_button.click(my_function, inputs=[my_input], outputs=[my_output])
31
+
32
+ # launch the program
33
+ my_demo.launch()