Gradio Space
Gradio provides an easy and intuitive interface for running a model from a list of inputs and displaying the outputs in formats such as images, audio, 3D objects, and more.
Create Gradio Space
In the process of Create Space, select Gradio SDK will create a Gradio Space.
Init
After creation, the system automatically generates only a README and a .gitattribute file for the user. At this point, the status of the space is Uninitialize. To run the space, you need to add the following two files.
First, you need to specify the version of Gradio for the space to run. On the "Files" page, click "Add File", then select "Create File" from the dropdown menu. Paste the following code into the editor and name the file requirements.txt
, then click "Create File".
gradio==4.44.0
Next, the application space requires a program file to run. The "App" page provides reference code for app.py
.
Copy the following reference code:
import gradio as gr
def greet(name):
return "Hello " + name + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
Switch to the "Files" page, click "Add File", then select "Create File" from the dropdown menu. Paste the code into the editor and name the file app.py
. After that, click "Create File."
Running
After the app.py
file is commited, the space will automatically start building the app. Once the build is complete, you can view the running results of the app.
You can change the code in app.py, create what you like in CSGHub!