๐๏ธ Gradio Apps
Overview Gradio Http Providerโ
The GradioProviderGenerator
is an interactive CLI tool that helps you create provider configurations from Gradio-hosted APIs, such as those on Hugging Face Spaces or standalone Gradio app URLs.
๐ How to Useโ
Run the CLI and follow the interactive prompts:
python main.py providers generate gradio --url <your_gradio_url_or_space>
Replace <your_gradio_url_or_space>
with either a Hugging Face Space name or a full Gradio app URL.
๐ Supported url Input Optionsโ
You can initialize the generator using either:
-
Hugging Face Space name
Format:username/space_name
Example:detoxioai/Pokebot
-
Direct Gradio app URL
Example:https://medusa.detoxio.dev
๐งญ Walkthroughโ
-
Inspect or Generate: Choose whether you want to inspect available APIs or directly generate a provider.
-
Select APIs: The tool lists all available API endpoints. Choose one or more to include.
-
Configure Parameters:
For each selected API:- Enter values for parameters.
- If a parameter accepts multiple options (e.g.,
Literal
), you'll be prompted to pick one. - Jinja template syntax like
{{prompt}}
can be used for dynamic inputs.
-
Response Parsing (Auto-Detected):
The tool will analyze the response and suggest a parsing strategy using:parser_type
: Signature-based parsingcontent_type
: e.g.,array
,json
location
: Index path to the desired value in the response
-
Save Configuration:
After generation, the provider configuration is saved as a.yaml
file (default:gradio_providers.yaml
).
โ Example Outputโ
โฏ python main.py providers generate gradio --url https://medusa.detoxio.dev
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Gradio Provider Generator โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Do you want to (1) Inspect APIs or (2) Generate Providers? (Enter 1 or 2) (2): 2
Available APIs
โโโโโโโโโณโโโโโโโโโโโ
โ Index โ API Path โ
โกโโโโโโโโโโโโโโโโโโโฉ
โ 1 โ /greet โ
โ 2 โ /greet_1 โ
โ 3 โ /greet_2 โ
โโโโโโโโโดโโโโโโโโโโโ
Enter the numbers of the APIs you want to use (comma-separated) (): 1
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Configuring parameters for API: /greet โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Enter value for 'prompt' (press Enter to keep default: None) (): {{prompt}}
Enter value for 'detoxio_api_key' (press Enter to keep default: ) ():
Choose a value for 'challenge' from: Your Math Assistant, Your SQL DB Assistant, GPT Leaky Assistant, Your Fintech Assistant, GPT Text2SQL Agent
Enter value for 'challenge' (press Enter to keep default: Your Math Assistant) (Your Math Assistant):
Choose a value for 'challenge_level' from: easy, easy, medium, medium, medium
Enter value for 'challenge_level' (press Enter to keep default: easy) (easy):
Provider generated successfully!
Loaded as API: https://medusa.detoxio.dev/ โ
Generated Response Location : `{'parser_type': 'signature', 'content_type': 'array', 'location': [1, -1, 1]}`
Do you want to exit? (yes/no) (yes): yes
Enter filename to save as (default: gradio_providers.yaml) (gradio_providers.yaml): y
Configuration saved to y โ
๐ Output File (y
)โ
providers:
- id: gradio
config:
url: https://medusa.detoxio.dev
apis:
- path: /greet
params:
- name: prompt
value: '{{prompt}}'
- name: detoxio_api_key
value: ''
- name: challenge
value: Your Math Assistant
- name: challenge_level
value: easy
transform_response:
parser_type: signature
content_type: array
location:
- 1
- -1
- 1