layers2024 commited on
Commit
30de909
·
verified ·
1 Parent(s): a914809

Upload folder using huggingface_hub

Browse files
.github/workflows/update_space.yml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Run Python script
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v2
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v2
18
+ with:
19
+ python-version: '3.9'
20
+
21
+ - name: Install Gradio
22
+ run: python -m pip install gradio
23
+
24
+ - name: Log in to Hugging Face
25
+ run: python -c 'import huggingface_hub; huggingface_hub.login(token="${{ secrets.hf_token }}")'
26
+
27
+ - name: Deploy to Spaces
28
+ run: gradio deploy
.gitignore ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+ MANIFEST
26
+
27
+ # Virtual environments
28
+ venv/
29
+ ENV/
30
+ env/
31
+ .venv/
32
+ .ENV/
33
+ .env/
34
+
35
+ # PyInstaller
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+
56
+ # pytest
57
+ .pytest_cache/
58
+
59
+ # mypy
60
+ .mypy_cache/
61
+ .dmypy.json
62
+ dmypy.json
63
+
64
+ # Pylint
65
+ .pylint.d/
66
+
67
+ # Pyre
68
+ .pyre/
69
+
70
+ # Cython debug symbols
71
+ cython_debug/
72
+
73
+ # VS Code
74
+ .vscode/
75
+
76
+ # PyCharm
77
+ .idea/
78
+
79
+ # MacOS
80
+ .DS_Store
81
+
82
+ # Windows
83
+ Thumbs.db
84
+ desktop.ini
.gradio/certificate.pem ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
3
+ TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
4
+ cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
5
+ WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
6
+ ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
7
+ MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
8
+ h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
9
+ 0TM8ukj13Xnfs7j/Ev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LCgdNbOhdjsnvzqvHu7Ur
25
+ TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
26
+ jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
27
+ oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
28
+ 4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
29
+ mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
30
+ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
31
+ -----END CERTIFICATE-----
.gradio/flagged/dataset1.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ name,intensity,output,timestamp
2
+ Luciano,0,"Hello, Luciano",2025-03-23 10:07:56.441661
3
+ BoW WoW,100,"Hello, BoW WoW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",2025-03-23 10:10:49.900935
4
+ Nino,57,"Hello, Nino!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",2025-03-23 10:28:38.222292
README.md CHANGED
@@ -1,12 +1,89 @@
1
  ---
2
- title: Gradio Demo
3
- emoji: 📊
4
- colorFrom: yellow
5
- colorTo: blue
6
  sdk: gradio
7
  sdk_version: 5.22.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
+ title: gradio-demo
3
+ app_file: app.py
 
 
4
  sdk: gradio
5
  sdk_version: 5.22.0
 
 
6
  ---
7
+ # Gradio: Demo for Machine Learning Web Apps in Python
8
+
9
+ Gradio is an open-source Python library that makes it easy to create customizable, interactive web interfaces for machine learning models. It enables you to build demos rapidly without requiring extensive web development expertise. With Gradio, you can share your models with collaborators or the public, test them live, and even deploy them on cloud platforms for free. Its intuitive interface and simple API allow you to focus on your model rather than the underlying infrastructure.
10
+
11
+ ## Benefits of Using Gradio
12
+
13
+ - **User-Friendly Interfaces:** Quickly generate interactive demos that allow users to experiment with machine learning models.
14
+ - **Ease of Integration:** Integrate with popular frameworks like TensorFlow, PyTorch, and scikit-learn.
15
+ - **Rapid Prototyping:** Build and iterate on your model’s interface in minutes.
16
+ - **Shareability:** Easily share your demos via public URLs that can be generated with a single command.
17
+ - **Deployment Options:** Deploy on local servers, cloud services, or platforms like Hugging Face Spaces for free hosting and GPU access.
18
+
19
+ ## Installation
20
+
21
+ Follow these steps to set up the project environment:
22
+
23
+ 1. **Create a virtual environment:**
24
+
25
+ ```bash
26
+ python -m venv .venv
27
+ ```
28
+
29
+ 2. **Activate the virtual environment:**
30
+
31
+ ```bash
32
+ source .venv/bin/activate
33
+ ```
34
+
35
+ 3. **Install Gradio:**
36
+
37
+ ```bash
38
+ pip install --upgrade gradio
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ 1. **Run the application:**
44
+
45
+ ```bash
46
+ python app.py
47
+ ```
48
+
49
+ 2. **Open the URL in your browser:**
50
+
51
+ ```bash
52
+ open http://localhost:7860
53
+ ```
54
+
55
+ 3. **Interact with the app:**
56
+ Use the interface and optionally click the **Flag** button to save data to a local dataset located at `.gradio/flagged/dataset1.csv`.
57
+
58
+ ## Running in Hot Reload Mode
59
+
60
+ For live modifications, run the app with Gradio’s built-in hot-reload feature:
61
+
62
+ ```bash
63
+ gradio app.py
64
+ ```
65
+
66
+ ## Deployment
67
+
68
+ ### Temporary Public URL
69
+
70
+ Deploy your app with a public URL by passing the optional parameter `share=True` to the `launch` method in your code:
71
+
72
+ ```python
73
+ demo.launch(share=True)
74
+ ```
75
+
76
+ _Note: The share link expires in 72 hours._
77
+
78
+ ### Permanent Hosting on Hugging Face Spaces
79
+
80
+ For free, permanent hosting with GPU support, deploy your app on [Hugging Face Spaces](https://huggingface.co/spaces):
81
+
82
+ ```bash
83
+ gradio deploy
84
+ ```
85
+
86
+ ## References & Resources
87
 
88
+ - [Gradio GitHub Repository](https://github.com/gradio-app/gradio)
89
+ - [Gradio Documentation](https://gradio.app/)
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+ def greet(name, intensity):
5
+ return "Hello, " + name + "!" * int(intensity)
6
+
7
+
8
+ demo = gr.Interface(fn=greet, inputs=["text", "slider"], outputs="text")
9
+
10
+ # Launch the application with public URL
11
+ # The app will run locally directly from your machine
12
+ # A public URL will be assigned
13
+ demo.launch(share=True)